conf: Use the right maximum buffer size for c->sock_path
UNIX_SOCK_MAX is the maximum number we'll append to the socket path if we generate it automatically. If it's given on the command line, it can be up to UNIX_PATH_MAX (including the terminating character) long. UNIX_SOCK_MAX happened to kind of fit because it's 100 (instead of 108). Commitceddcac74a
("conf, tap: False "Buffer not null terminated" positives, CWE-170") fixed the wrong problem: the right fix for the problem at hand was actually commitcc287af173
("conf: Fix incorrect bounds checking for sock_path parameter"). Fixes:ceddcac74a
("conf, tap: False "Buffer not null terminated" positives, CWE-170") Signed-off-by: Stefano Brivio <sbrivio@redhat.com> Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
parent
403a7c14a0
commit
b625ed5fee
1 changed files with 1 additions and 1 deletions
2
conf.c
2
conf.c
|
@ -1398,7 +1398,7 @@ void conf(struct ctx *c, int argc, char **argv)
|
|||
c->foreground = 1;
|
||||
break;
|
||||
case 's':
|
||||
ret = snprintf(c->sock_path, UNIX_SOCK_MAX - 1, "%s",
|
||||
ret = snprintf(c->sock_path, sizeof(c->sock_path), "%s",
|
||||
optarg);
|
||||
if (ret <= 0 || ret >= (int)sizeof(c->sock_path))
|
||||
die("Invalid socket path: %s", optarg);
|
||||
|
|
Loading…
Reference in a new issue