From: jiangg <jiangg@mail.ustc.edu.cn>
To: dev@dpdk.org
Cc: jiangg <jiangg@mail.ustc.edu.cn>
Subject: [dpdk-dev] [PATCH] examples/vhost: fix the use of strnlen()
Date: Sun, 16 Apr 2017 19:39:40 +0800 [thread overview]
Message-ID: <1492342780-3810-1-git-send-email-jiangg@mail.ustc.edu.cn> (raw)
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
next reply other threads:[~2017-04-16 11:40 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-16 11:39 jiangg [this message]
2017-05-05 12:11 ` Thomas Monjalon
2017-05-05 13:59 ` Gang Jiang
2017-05-10 17:06 ` Thomas Monjalon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1492342780-3810-1-git-send-email-jiangg@mail.ustc.edu.cn \
--to=jiangg@mail.ustc.edu.cn \
--cc=dev@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).