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 67E24A0093 for ; Tue, 19 May 2020 15:12:56 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 5F00F1D8D6; Tue, 19 May 2020 15:12:56 +0200 (CEST) Received: from mail-wm1-f67.google.com (mail-wm1-f67.google.com [209.85.128.67]) by dpdk.org (Postfix) with ESMTP id 3040B1D702 for ; Tue, 19 May 2020 15:12:54 +0200 (CEST) Received: by mail-wm1-f67.google.com with SMTP id m185so3499785wme.3 for ; Tue, 19 May 2020 06:12:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=2M12+vMiCIEzMGhIYCFmeumUoz3cgPnfMLWHsJpQvjM=; b=q81/KmZsktg2V2YJPSIBOQKaIxWTzBYy52fcMFI9CguhIf/l01QwKE6rsDigZ6LrrY 8zb7W6e19Gsz5mOv3UrKdrwisaMcBYCu9PLDGG3namGSI9FUbT7CbxhzhIK3+P1CDxPF T3hKBOJDvH4tXQxFccoSlg6dxN437+9k+BSPQ0DFSxseKOuXbj+slKrlz+/2npbUxJSG MCgjCZ3EtWzQQH7rQU5v9aKOrsTkAszzY6MaPmV7MN4fFNjY4+UEopxoglwlLTwyd8vJ hfEwFREk7hMFWKiO2dl83EnzlvZydhsKPYcMdPDdhl3bj+XhJP8KcjfKiErqMkrE0Cmr RmRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=2M12+vMiCIEzMGhIYCFmeumUoz3cgPnfMLWHsJpQvjM=; b=CLevWcTlUupqeS8iJOMwkQdr0OTb2lpHbRLTOec5kd9pKLEV1iykioL/mW2fMJ5cc1 f+2p59gBTrUQ1zl3pDPehY3W12ILh8t41qAgcIQd9dLD5zL/ZxeRMPlCu0Bv2u3WQ5Uu yMbtVWNFe0OKfF+m8tAy2J2UCvjqaMC+/6c5gKPLLxMiwr5bYvQhOQF4/ASK4508j5mN 5MDCgHScTiBFNpU3gsRSkv9G66Qy7AF0rEH7w5LUf/bvPTgClge9QdyckcBHVDGacWro 1EYrLtMGqM1BI9HlZtl+M3gX6sBfPY6skqCK+BUAIAS5bklOzGGlxI/FJ8ZHN7lQstT3 e0TQ== X-Gm-Message-State: AOAM531GyfJwidf268eBL4805QV5jKnpnmmTfE2SkE5C0rG2Fnk6LCaH wktvOvBqBQZz+t8CEHx1RhY= X-Google-Smtp-Source: ABdhPJw/e/MvRUh5HZuTTrwG7UdW4DDA+wKDcAqOFMg9IH8dqgJCM0qbPnh14zsmhKNSHohQV5DuRA== X-Received: by 2002:a1c:9a09:: with SMTP id c9mr5250251wme.159.1589893973942; Tue, 19 May 2020 06:12:53 -0700 (PDT) Received: from localhost ([88.98.246.218]) by smtp.gmail.com with ESMTPSA id p65sm3854738wmp.36.2020.05.19.06.12.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 May 2020 06:12:53 -0700 (PDT) From: luca.boccassi@gmail.com To: Olivier Matz Cc: dpdk stable Date: Tue, 19 May 2020 14:04:29 +0100 Message-Id: <20200519130549.112823-134-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200519130549.112823-1-luca.boccassi@gmail.com> References: <20200519125804.104349-1-luca.boccassi@gmail.com> <20200519130549.112823-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'kvargs: fix invalid token parsing on FreeBSD' has been queued to stable release 19.11.3 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" Hi, FYI, your patch has been queued to stable release 19.11.3 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 05/21/20. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Thanks. Luca Boccassi --- >From 2acc78a0a186b598cadcc14b59f8df480d0a6ae9 Mon Sep 17 00:00:00 2001 From: Olivier Matz Date: Wed, 29 Apr 2020 15:17:00 +0200 Subject: [PATCH] kvargs: fix invalid token parsing on FreeBSD MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [ upstream commit b2aa2c9723796d81cb9216f3a5c5e195796985fa ] The behavior of strtok_r() is not the same between GNU libc and FreeBSD libc: in the first case, the context is set to "" when the last token is returned, while in the second case it is set to NULL. On FreeBSD, the current code crashes because we are dereferencing a NULL pointer (ctx1). Fix it by first checking if it is NULL. This works with both GNU and FreeBSD libc. Fixes: ffcf831454a9 ("kvargs: fix buffer overflow when parsing list") Signed-off-by: Olivier Matz Tested-by: Zhimin Huang --- lib/librte_kvargs/rte_kvargs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/librte_kvargs/rte_kvargs.c b/lib/librte_kvargs/rte_kvargs.c index 1d815dcd96..285081c86c 100644 --- a/lib/librte_kvargs/rte_kvargs.c +++ b/lib/librte_kvargs/rte_kvargs.c @@ -50,7 +50,7 @@ rte_kvargs_tokenize(struct rte_kvargs *kvlist, const char *params) /* Find the end of the list. */ while (str[strlen(str) - 1] != ']') { /* Restore the comma erased by strtok_r(). */ - if (ctx1[0] == '\0') + if (ctx1 == NULL || ctx1[0] == '\0') return -1; /* no closing bracket */ str[strlen(str)] = ','; /* Parse until next comma. */ -- 2.20.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2020-05-19 14:04:49.901634272 +0100 +++ 0134-kvargs-fix-invalid-token-parsing-on-FreeBSD.patch 2020-05-19 14:04:44.444652506 +0100 @@ -1,4 +1,4 @@ -From b2aa2c9723796d81cb9216f3a5c5e195796985fa Mon Sep 17 00:00:00 2001 +From 2acc78a0a186b598cadcc14b59f8df480d0a6ae9 Mon Sep 17 00:00:00 2001 From: Olivier Matz Date: Wed, 29 Apr 2020 15:17:00 +0200 Subject: [PATCH] kvargs: fix invalid token parsing on FreeBSD @@ -6,6 +6,8 @@ Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit +[ upstream commit b2aa2c9723796d81cb9216f3a5c5e195796985fa ] + The behavior of strtok_r() is not the same between GNU libc and FreeBSD libc: in the first case, the context is set to "" when the last token is returned, while in the second case it is set to NULL. @@ -15,7 +17,6 @@ both GNU and FreeBSD libc. Fixes: ffcf831454a9 ("kvargs: fix buffer overflow when parsing list") -Cc: stable@dpdk.org Signed-off-by: Olivier Matz Tested-by: Zhimin Huang