From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <stable-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 65EC9A04A2
	for <public@inbox.dpdk.org>; Mon, 11 May 2020 11:22:40 +0200 (CEST)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id 4B7E31C243;
	Mon, 11 May 2020 11:22:40 +0200 (CEST)
Received: from mga17.intel.com (mga17.intel.com [192.55.52.151])
 by dpdk.org (Postfix) with ESMTP id 31B791C00F;
 Mon, 11 May 2020 11:22:36 +0200 (CEST)
IronPort-SDR: aPbmegjC0tK9YcjOO6LbPzUWDhd62OYT77ffPdqpF79jgfLMsccibtHSPubPDmnKzG+eoFNO1n
 7TZcsN+PEWNw==
X-Amp-Result: SKIPPED(no attachment in message)
X-Amp-File-Uploaded: False
Received: from orsmga006.jf.intel.com ([10.7.209.51])
 by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;
 11 May 2020 02:22:36 -0700
IronPort-SDR: oRd8q/ST1TkLhaBFDIZxMvYlGCqRZEqIebECEtkK6szhVP4kRqAVXkqBOQNLkuJIdghF9Jk0ld
 ASbpGqlY3NGA==
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.73,379,1583222400"; d="scan'208";a="265097296"
Received: from silpixa00400072.ir.intel.com ([10.237.222.213])
 by orsmga006.jf.intel.com with ESMTP; 11 May 2020 02:22:35 -0700
From: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
To: dev@dpdk.org
Cc: stable@dpdk.org
Date: Mon, 11 May 2020 10:22:32 +0100
Message-Id: <e12f63c5bd8af410eb0c3d2c2455e1d89d6ad51b.1589188908.git.vladimir.medvedkin@intel.com>
X-Mailer: git-send-email 2.7.4
Subject: [dpdk-stable] [PATCH] app/test-fib: fix unchecked return value
X-BeenThere: stable@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: patches for DPDK stable branches <stable.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/stable>,
 <mailto:stable-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/stable/>
List-Post: <mailto:stable@dpdk.org>
List-Help: <mailto:stable-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/stable>,
 <mailto:stable-request@dpdk.org?subject=subscribe>
Errors-To: stable-bounces@dpdk.org
Sender: "stable" <stable-bounces@dpdk.org>

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