DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] examples/vhost: fix the use of strnlen()
@ 2017-04-16 11:39 jiangg
  2017-05-05 12:11 ` Thomas Monjalon
  0 siblings, 1 reply; 4+ messages in thread
From: jiangg @ 2017-04-16 11:39 UTC (permalink / raw)
  To: dev; +Cc: jiangg

The return value of strnlen(s, maxlen) is never bigger than maxlen.

Signed-off-by: jiangg <jiangg@mail.ustc.edu.cn>
---
 examples/vhost/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/examples/vhost/main.c b/examples/vhost/main.c
index aa88733..e07f866 100644
--- a/examples/vhost/main.c
+++ b/examples/vhost/main.c
@@ -396,7 +396,7 @@ static int
 us_vhost_parse_socket_path(const char *q_arg)
 {
 	/* parse number string */
-	if (strnlen(q_arg, PATH_MAX) > PATH_MAX)
+	if (strnlen(q_arg, PATH_MAX) == PATH_MAX)
 		return -1;
 
 	socket_files = realloc(socket_files, PATH_MAX * (nb_sockets + 1));
-- 
2.7.4

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-05-10 17:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-16 11:39 [dpdk-dev] [PATCH] examples/vhost: fix the use of strnlen() jiangg
2017-05-05 12:11 ` Thomas Monjalon
2017-05-05 13:59   ` Gang Jiang
2017-05-10 17:06     ` Thomas Monjalon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).