From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 17609A0350; 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 0D4621C191; Mon, 11 May 2020 11:22:39 +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 To: dev@dpdk.org Cc: stable@dpdk.org Date: Mon, 11 May 2020 10:22:32 +0100 Message-Id: X-Mailer: git-send-email 2.7.4 Subject: [dpdk-dev] [PATCH] app/test-fib: fix unchecked return value X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 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