patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
To: dev@dpdk.org
Cc: stable@dpdk.org
Subject: [dpdk-stable] [PATCH] app/test-fib: fix unchecked return value
Date: Mon, 11 May 2020 10:22:32 +0100	[thread overview]
Message-ID: <e12f63c5bd8af410eb0c3d2c2455e1d89d6ad51b.1589188908.git.vladimir.medvedkin@intel.com> (raw)

Check returned value after strtok()
CID 355674 (#1 of 1): Dereference null return value (NULL_RETURNS)
4. dereference: Dereferencing a pointer that might be NULL s when
calling inet_pton

Fixes: 103809d032cd ("app/test-fib: add test application for FIB")
Cc: stable@dpdk.org

Signed-off-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
---
 app/test-fib/main.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/app/test-fib/main.c b/app/test-fib/main.c
index 6e80d65..9cf01b1 100644
--- a/app/test-fib/main.c
+++ b/app/test-fib/main.c
@@ -543,6 +543,8 @@ parse_lookup(FILE *f, int af)
 
 	while (fgets(line, sizeof(line), f) != NULL) {
 		s = strtok(line, " \t\n");
+		if (s == NULL)
+			return -EINVAL;
 		ret = inet_pton(af, s, &tbl[i]);
 		if (ret != 1)
 			return -EINVAL;
-- 
2.7.4


             reply	other threads:[~2020-05-11  9:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-11  9:22 Vladimir Medvedkin [this message]
2020-05-19 17:45 ` 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=e12f63c5bd8af410eb0c3d2c2455e1d89d6ad51b.1589188908.git.vladimir.medvedkin@intel.com \
    --to=vladimir.medvedkin@intel.com \
    --cc=dev@dpdk.org \
    --cc=stable@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).