Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp2360659pxb; Mon, 20 Sep 2021 20:05:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx9e14RYWeJ3Fl6s1KI8RUUVYi1e1A/SAxny12La/l6CabnhEPSwXxpNPWoKYTUWaS0uKEq X-Received: by 2002:a50:cf03:: with SMTP id c3mr24267007edk.236.1632193559463; Mon, 20 Sep 2021 20:05:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632193559; cv=none; d=google.com; s=arc-20160816; b=PPjV492yp1KsDmJXgi/P4GDA6lzsdyZQtiysDHLAc4IcF+o99iA9EIGAG81Sd661zW XiCh0w8e4JuTWIZmwyfVKu6uo/VW0OAOtgyhknuA5gZEbmUAhOwCdWVL9CTmPEvmY0c6 s5zM6xPGjBWvhNFxKVxNlSrFr334VdtlbybPw3I5HJvipyAWFqcPs8SqEcbmvLWe/dhe 1TUzJsn+hY0kXPSJxWOlQ5oRjR6NkTcHmlne/KlNQ2ZHYwHkkm7oB21AXeOK6DNRWRe4 BRAG2jU4gLiSpHXdoomIfb29A/6AXNe63FldLJeM2nS33tU1d1G97lLEtq5rRr/k/bWe Zjgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=Bg7MGhSoOjG1QT/fr/oakK9+72mfU8xF/hRrUlEiVbY=; b=E70S+rfUFz1xVP10w+6a6QXiSLyUaKQ6uPr7fgW3ex2yZQeFJwcanKXDzA45nNrkCS kZxuZJW4QNOTiifBD5vnQZ8DlExZbUJlTYVak7b+Iy0PMk/UniL0dqOIpkoCguPx5qSL JjdAX4GLZZhNEmIQky9qTf/bMJpgdkRv0oiF5ZHqE7SjbmqZ2C6C++ycpiw12hxkLcYU aFWMBlZZFHxFEEz+WpYLFW1vxRLQg2Gd9T/JhtokyHlqWLCBJN9lRjP6Vz8eERYtsw5X 55VeK5srjbk7GbrDCCs77tPnJh7Fbh3yfACOyu/570ljC8ECjeygDKYKiE1RN5zcLtua 1khA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id nd8si18569248ejc.657.2021.09.20.20.05.35; Mon, 20 Sep 2021 20:05:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344264AbhITVnr (ORCPT + 99 others); Mon, 20 Sep 2021 17:43:47 -0400 Received: from lithops.sigma-star.at ([195.201.40.130]:35350 "EHLO lithops.sigma-star.at" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238989AbhITVlk (ORCPT ); Mon, 20 Sep 2021 17:41:40 -0400 Received: from localhost (localhost [127.0.0.1]) by lithops.sigma-star.at (Postfix) with ESMTP id 8715D6169BCC; Mon, 20 Sep 2021 23:40:11 +0200 (CEST) Received: from lithops.sigma-star.at ([127.0.0.1]) by localhost (lithops.sigma-star.at [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id FrKaLuZiFFX7; Mon, 20 Sep 2021 23:40:10 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by lithops.sigma-star.at (Postfix) with ESMTP id A0D3E616E131; Mon, 20 Sep 2021 23:40:10 +0200 (CEST) Received: from lithops.sigma-star.at ([127.0.0.1]) by localhost (lithops.sigma-star.at [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id k65h5FpABQpK; Mon, 20 Sep 2021 23:40:10 +0200 (CEST) Received: from blindfold.corp.sigma-star.at (213-47-184-186.cable.dynamic.surfer.at [213.47.184.186]) by lithops.sigma-star.at (Postfix) with ESMTPSA id 0BBF86169BC6; Mon, 20 Sep 2021 23:40:09 +0200 (CEST) From: Richard Weinberger To: masahiroy@kernel.org Cc: linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org, Richard Weinberger Subject: [PATCH 2/2] kconfig: Deny command substitution in string values Date: Mon, 20 Sep 2021 23:39:57 +0200 Message-Id: <20210920213957.1064-2-richard@nod.at> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210920213957.1064-1-richard@nod.at> References: <20210920213957.1064-1-richard@nod.at> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The post processed .config file will get included in shell and makefiles. So make sure that a string does not contain symbols that allow command substitution. If such a malformed string is found, return empty string and report it. Signed-off-by: Richard Weinberger --- scripts/kconfig/symbol.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c index 4a31bb943f79..1035ecdddc99 100644 --- a/scripts/kconfig/symbol.c +++ b/scripts/kconfig/symbol.c @@ -880,6 +880,11 @@ const char *sym_escape_string(struct symbol *sym) =20 in =3D sym_get_string_value(sym); =20 + if (strspn(in, "`$")) { + fprintf(stderr, "%s: invalid characters in string found\n", sym->name)= ; + return xstrdup("\"\""); + } + reslen =3D strlen(in) + strlen("\"\"") + 1; =20 p =3D in; --=20 2.26.2