From 5876077aba8c1bf8a46f08ae27b880e3f7f8550f Mon Sep 17 00:00:00 2001 From: Vladimir Medvedkin Date: Mon, 11 May 2020 10:22:32 +0100 Subject: [PATCH] app/fib: fix parsing of invalid line 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 --- 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 6e80d65f4c..9cf01b16e5 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.20.1