examples/vhost: fix socket path parsing
The return value of strnlen(s, maxlen) is never bigger than maxlen. Fixes: 4796ad63ba1f ("examples/vhost: import userspace vhost application") Signed-off-by: Gang Jiang <jiangg@mail.ustc.edu.cn>
This commit is contained in:
parent
08dd403dbd
commit
fa81d3b970
@ -396,7 +396,7 @@ static int
|
|||||||
us_vhost_parse_socket_path(const char *q_arg)
|
us_vhost_parse_socket_path(const char *q_arg)
|
||||||
{
|
{
|
||||||
/* parse number string */
|
/* parse number string */
|
||||||
if (strnlen(q_arg, PATH_MAX) > PATH_MAX)
|
if (strnlen(q_arg, PATH_MAX) == PATH_MAX)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
socket_files = realloc(socket_files, PATH_MAX * (nb_sockets + 1));
|
socket_files = realloc(socket_files, PATH_MAX * (nb_sockets + 1));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user