firewall-util: add an assert that we're not overwriting a buffer

Check for CID #1368267.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2017-02-19 13:19:50 -05:00
parent 1e94df4471
commit f28501279d
1 changed files with 4 additions and 1 deletions

View File

@ -76,8 +76,11 @@ static int entry_fill_basics(
}
if (out_interface) {
size_t l = strlen(out_interface);
assert(l < sizeof entry->ip.outiface && l < sizeof entry->ip.outiface_mask);
strcpy(entry->ip.outiface, out_interface);
memset(entry->ip.outiface_mask, 0xFF, strlen(out_interface)+1);
memset(entry->ip.outiface_mask, 0xFF, l + 1);
}
if (destination) {
entry->ip.dst = destination->in;