summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2017-02-19 13:19:50 -0500
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2017-02-20 16:02:15 -0500
commitf28501279d2c28fdbb31d8273b723e9bf71d3b98 (patch)
tree1d240276ada05668ba0100143505b2227fc64490 /src
parent1e94df447150f065241091044b32a730a5bf9ed4 (diff)
downloadsystemd-f28501279d2c28fdbb31d8273b723e9bf71d3b98.tar.gz
firewall-util: add an assert that we're not overwriting a buffer
Check for CID #1368267.
Diffstat (limited to 'src')
-rw-r--r--src/shared/firewall-util.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/shared/firewall-util.c b/src/shared/firewall-util.c
index 9c29b0afca..952fc48c45 100644
--- a/src/shared/firewall-util.c
+++ b/src/shared/firewall-util.c
@@ -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;