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

... like commit f28501279d does for
out_interface.
This commit is contained in:
David Tardon 2018-10-10 09:33:28 +02:00
parent e99742ef3e
commit 0b777d20e9
1 changed files with 7 additions and 1 deletions

View File

@ -50,8 +50,14 @@ static int entry_fill_basics(
entry->ip.proto = protocol;
if (in_interface) {
size_t l;
l = strlen(in_interface);
assert(l < sizeof entry->ip.iniface);
assert(l < sizeof entry->ip.iniface_mask);
strcpy(entry->ip.iniface, in_interface);
memset(entry->ip.iniface_mask, 0xFF, strlen(in_interface)+1);
memset(entry->ip.iniface_mask, 0xFF, l + 1);
}
if (source) {
entry->ip.src = source->in;