mirror of
https://passt.top/passt
synced 2025-06-10 01:25:34 +02:00
conf, tap: False "Buffer not null terminated" positives, CWE-170
Those strings are actually guaranteed to be NULL-terminated. Reported by Coverity. Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
This commit is contained in:
parent
e46f67f152
commit
ceddcac74a
2 changed files with 6 additions and 6 deletions
6
conf.c
6
conf.c
|
@ -1035,7 +1035,7 @@ void conf(struct ctx *c, int argc, char **argv)
|
|||
usage(argv[0]);
|
||||
}
|
||||
|
||||
ret = snprintf(c->sock_path, sizeof(c->sock_path), "%s",
|
||||
ret = snprintf(c->sock_path, UNIX_SOCK_MAX - 1, "%s",
|
||||
optarg);
|
||||
if (ret <= 0 || ret >= (int)sizeof(c->pcap)) {
|
||||
err("Invalid socket path: %s", optarg);
|
||||
|
@ -1048,9 +1048,9 @@ void conf(struct ctx *c, int argc, char **argv)
|
|||
usage(argv[0]);
|
||||
}
|
||||
|
||||
ret = snprintf(c->pasta_ifn, sizeof(c->pasta_ifn), "%s",
|
||||
ret = snprintf(c->pasta_ifn, IFNAMSIZ - 1, "%s",
|
||||
optarg);
|
||||
if (ret <= 0 || ret >= (int)sizeof(c->pasta_ifn)) {
|
||||
if (ret <= 0 || ret >= IFNAMSIZ - 1) {
|
||||
err("Invalid interface name: %s", optarg);
|
||||
usage(argv[0]);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue