From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D73442E7BD6 for ; Sat, 5 Sep 2026 12:32:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.41 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788611569; cv=none; b=T/A/ZRmGW4/PvjTEP/3tEe213A9vyY3QMIAp8dNgoEPsRd/gktRhfBBLg+v1/+0S03l90erLiiPlSwFf9AvfI13Kmc9DEziiVdyqExmQAmulYMZqbyGWVrI9s5EsGw7OUNIJsURoD3+iSjlBo46IcQZOf7JTikuPFRavPwb+y44= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788611569; c=relaxed/simple; bh=Zqnc75eH9l1R1ldneMAODSFBcp3t1bLl+QgbQnbmsEs=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=QYnSGe82emcI8NaFH4GB6yFGbvlJ61NGh1vRd7vYWjXTvXwfGLL+MGdc4DHidwD1FbHJYNyroQdI8TR/Fergyq4JohEHDi1DwkXz1yEFeFe90FAky3TMTv2R6Yi9WGp8pAmTba9/iUDU3WMZgpcVbSiTrBzUHZEZa0V1v9AIpc4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=k0rHXHRC; arc=none smtp.client-ip=209.85.128.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="k0rHXHRC" Received: by mail-wm1-f41.google.com with SMTP id 5b1f17b1804b1-49954b88fffso14305815e9.0 for ; Sat, 05 Sep 2026 05:32:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1788611566; x=1789216366; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=xWSSfgErFMktAfe6G35eCBTHHADB8r9vLVP06EqoFO8=; b=k0rHXHRCa8KR1d53eQMHG6o/T4zsqljG5W5MFxTsbL1+zQU9lrV2KoqR4YKEjB94ji PsOBvCXzikgT0/2AqMbiBTgAmr6KzG61Wfahx4iXZNAjWHfWtq2FzuMiJdc2FwSrg0X9 vc0vzw/iEKr5XPJLUcyydfQDw2jr/MFxjfz6kmqUmgZGLVXygTxYBkt0/L+ktT+qEOBR RdRIdbJJcq6EqpEZb2Uv7cHtSyLslu9zwFgjFbuFobnXQ8fuERU28D4VK+U2TsSJN8pB GKFMFU4K7emOGHu7COxBhcoJMLFeWusOy2pCIKIKSVEa6doWRd2pvvUgzAMiDwUTkwBo yZpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788611566; x=1789216366; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=xWSSfgErFMktAfe6G35eCBTHHADB8r9vLVP06EqoFO8=; b=iTtwiF2RlME6P/IMVroWmT9rMrViXhpPbI1oGCbMKkM4vx839fQBjJqUL5V+1YnZdm axjLSBbl/SoJbq55dx8JDkm4nxm1QMfO5WglIMntubWiGHxkw209tpjgcv+ug6Xtf5se MP2/DEXmiryeV95KxVeNJWBNwSxoNE3G0pj99IFKOe4bdVZMkHHjgq/iU2Hsd/RJfucL TJShKs1kxu4o4Tn6Iek9C4ibH1tFKrjZS0rF6yPGae7IMsMOA3Rrm/iwJJsFjNzCDKUi 053js574piN8hv3cXchS6blBc9bKN2fwYcmy0pHCS0ayjWT49qzB45eCZFGf9Ek+G4oo eG4Q== X-Forwarded-Encrypted: i=1; AKwUvBxZRK7j/ZfrnG4l0Pa2vPZK5dFA3GaCKmvUQSW7+n+auvZFCj5Z3RdC9di5VcufiJkFPhE58wLEfPX7oTQ=@vger.kernel.org X-Gm-Message-State: AFuF++nPxqiBQNxmaVrOnjdc7XBWJc9RIqhXj2i/ukX5kpZemkv32UgZ wcxg5ZIvl7VAx1NqZ9dCkIPqvNxa/YDUEnyfMBTvmKHsQp7Q9SEWsqt4 X-Gm-Gg: AYBFou1nVeAWf/k3BgyKhD3z8dV1bNxj/f5cPwSJodt3RFBWI13vNQKSQfkvD18hgya bqRT7et17Gcqn/8PkhbUo935OccxctcwvzM0rz4VWDVIZct3iD5EFmB79iJpb3EpbGeyVFxl80V ioHTL5VhrEWj9HirVCuqvr7oo5xhVyClXWQVGIExxtcJeoE2Io8lch1Vz8Cvu3pxBH14gvk9a56 N1xCXCGeaUrAbXEvDscuceU4Z+R61oGacdvbaXFFOSZ2DuAJEuSxz0bTJvdHuwNNMnV1iqBwPJa UTZedDdoNiXWAFf7rr1+Im6sq2DKWOHwFlwXktLdYd9BGbZ1VCNXivD7LXY27QZQrtSSF0zv8Iw P9YK+czV1eI1KyGOZ+D/lCEQpttTAFGAwch62YBzbJ5a2tt41wpsuBS0GFPmCIGaGysMLvviBQU rcRxNQwf6sfYFqL7TTxSOkwzvpje4ivpXHdkAQGgTaFzP0km1SVIupgXJ1v3C8ues8GmJQ93uE7 5memz3jEAX2+pmfL0c0kQpafz5qWVKjvw33JTrTsxpI0I8TLURo1V1fYr5q4ylmXtb/XzkM X-Received: by 2002:a05:600c:5493:b0:49b:8f18:714a with SMTP id 5b1f17b1804b1-49cf824a6c5mr128476055e9.12.1788611565868; Sat, 05 Sep 2026 05:32:45 -0700 (PDT) Received: from localhost.localdomain ([95.3.12.38]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-49ce831af89sm171800535e9.1.2026.09.05.05.32.44 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sat, 05 Sep 2026 05:32:45 -0700 (PDT) From: Erkan Erdem To: Nathan Chancellor , Nicolas Schier Cc: Erkan Erdem , Julian Braha , linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/2] kconfig: preserve the final answer when input has no newline Date: Sat, 5 Sep 2026 15:32:21 +0300 Message-ID: <20260905123237.40670-1-hexvalid@gmail.com> X-Mailer: git-send-email 2.50.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit conf_string() unconditionally removes the last character returned by fgets(), assuming that it is a newline. When redirected input ends without a newline, the last character is part of the answer instead. For example, feeding 42 to an integer prompt stores 4, and feeding 0xff to a hexadecimal prompt stores 0xf. Both commands succeed despite silently changing the supplied value. Strip the newline with strcspn() so that a complete answer at EOF is preserved. Keep the existing handling of newline-terminated and empty answers unchanged. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Assisted-by: LLM Signed-off-by: Erkan Erdem --- An AI coding assistant found the issue, prepared the fix and changelog, and ran the verification below after a request to find reproducible functional bugs in Linux development tools. Validation: - Built conf with Clang on macOS and GCC in an x86_64 Linux container, using -Wall -Wmissing-prototypes -Wstrict-prototypes -Werror. - Ran 60 before/after executions on each platform, covering oldaskconfig and oldconfig with string, int and hex answers. Unterminated answers retain their last character. Newline, empty-answer, empty-input and CRLF controls keep the same results. - The 21 existing Kconfig tests pass on macOS. - This tests the host configuration tool; a complete kernel was not built. scripts/kconfig/conf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c index fe8ba09b..46c9ca64 100644 --- a/scripts/kconfig/conf.c +++ b/scripts/kconfig/conf.c @@ -343,7 +343,7 @@ static int conf_string(struct menu *menu) } /* fall through */ default: - line[strlen(line)-1] = 0; + line[strcspn(line, "\n")] = 0; def = line; } if (def && sym_set_string_value(sym, def)) base-commit: 4d7d9486c04d917265f64c55bd23b2cc4fe7749c -- 2.50.1 (Apple Git-155)