From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.42]) (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 7DA3E3126C0 for ; Mon, 3 Aug 2026 14:30:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.42 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785767457; cv=none; b=nv5TaKLGE11UQw4VvxMUBKKEBrPxwcPzE+RKD4GA+l9R26Vd/mK0pgYgYRylSDfsJY+Hfs9OB6qENrUjLwhBK2aW72vPit2GGxc4aLURQbmqlNcCSitXK1njXBzzVuVQn2uHy2uB6KuYniRDmHaxqTVMtq5cR4QCyeL2C6oOEkU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785767457; c=relaxed/simple; bh=OA1LKTN49b5FUMf9V/yVYL0uyXf1T9fnPQ99xO6TDc4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=J35zECd+pDVSL5bId9ESPR8HpOLHnOlxByrVjnEgvOJmxHOTXAh/qUnirGzzAA/Buy8NnnbxQQEA5r3KHChSWnMQemI9Sxnr6Hyr2sS2fL2n9NWXIwKqeNZ8Q3LWM70nrps2Rurc3mEOhZ8dqbnIbB1pt+Z7NoP3wFM/5jsp31U= 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=j5U5yhws; arc=none smtp.client-ip=209.85.128.42 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="j5U5yhws" Received: by mail-wm1-f42.google.com with SMTP id 5b1f17b1804b1-4957eefd361so14966165e9.1 for ; Mon, 03 Aug 2026 07:30:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1785767452; x=1786372252; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=9gdrr7AdAYBlVDbcFRIgxo33EdXDmWd6yiBKqM/w3XU=; b=j5U5yhwsTyH+U4iVWzHP8r5NInK1VVUwZW1yOXBWcT/bJGPZbJ428AEpdRbAWPRake ZFtN2WPAwhCQs7wpo3uVAQdmAxfA8kdaZTXVniLGgqjt+z9cURPQuEUJgUv5kZMpmbFi u7ppiqqdvSJdP7OTyDDbc1+pFgxKItGFHXCpRuBBb7DoTFrSGhg70pvQ5mV4s+9Dc0sC SFCUf5F8R44nhU5Flznl3ESnEVtsvQng9hk09yNSaEYBBNSXZqHXAF4HA/wgyBL52IP8 JJ4HkwwxpcOu28y2VR1SfMpO1WBALv0YVAw2Ad0DhUgV5E+tGH2jVALM1RZTt174SsKn flUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785767452; x=1786372252; h=content-transfer-encoding:mime-version:references:in-reply-to :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=9gdrr7AdAYBlVDbcFRIgxo33EdXDmWd6yiBKqM/w3XU=; b=JiMYemhEGu36DLMn8iMW/ZjGdgmHet1t29h7//iaHXVrYlcASfnIiwhB+MnWukdkZh D1X0R38p+MG66e1o9HOm6milz8oxtDz8ZEZSSCmM26idQyI8Zzo3miHTsPzqP1ekO3Qc MclA+4yoaT6lCatIjB+OmR5PHmb9TfTrx+qZxtFCRftqMZNm+cgQ5vd42VjfkiWLIQeW oxLuy9akCeXUmWpXxeQk5mLykCxUDG/9F1k1mZpkfXWM4IUK4vHpr6SSt8TDajksTXg8 Z6lMOZB5cKAJlFKo4gB3elh6CwcS85/TTd2lTUYg5hd2ACBLJdNdWMfjSh+0VAxpYLWu RKzA== X-Forwarded-Encrypted: i=1; AHgh+RoAdfC2KiE3ramjIoBpjhKsyf08PuEOwoqZQF/iYlw7VkDiUHFn9W44MXFoSH4SDDwvcWT8dZUEzETSawo=@vger.kernel.org X-Gm-Message-State: AOJu0YyromT/cI571qVPGixONdt/H6DzVYQsP60fZuEDXs16bRDNDle3 WaMA6FRBVv7KWu7lkQ+2OqCOq6/yOpLnogNT3QdikJ1gyrAgNeOYT94/ X-Gm-Gg: AR+sD12SEBHFbs8wPwI0ijnNCBAQweerPaD/LW08DONnLF7cq5xuedCcCiyc1MENb8J CH2FJC/hBKZ17EfRmSjLYk1c2AeE3CvfHGRSYUsR0c5adoVTOK3qIMVndNFdiKzP7/aYnVla27H MjqB/ojZ81rDV0m9p2a/uPL2M6KJdvJB3nRQQQJGDxO1ZKyckFogO0ChU1VP1HwDgDbpLBR24Ri +5HVBuF15bP7+rJ75qxwINmt9qyXDIrW+8YL1qZNHzxeMKi9D7rBsD7bVhRhaqE2EGaFbrvU4f1 SWPkGTzbEr7oyRb8COeVmvkSGyFVTm7RVG7zAGEoMRK1Ibdt6MfiF9LFlp6+qgLarx9ZVjCmvlp 6k92UaEgcLSfSyO5l+R3leoJ8o04/0R0DCKDUgJyDlqYT5JBlFdMXEzVRiBnGmxSLnn3HjMbUm9 QbSeJryU2/wkkLTOpTKq5/oqHc+YfKfu2/ld8DC1XtWlJJ4dBi/x5hlbOEObqMq0frR0Ziec2CY LhGyytQAn0qRXYiA2TJJ2EqkyjqgHUh9SOSEcMQ7w== X-Received: by 2002:a05:600d:8492:b0:496:c2fd:1731 with SMTP id 5b1f17b1804b1-4980c64b96dmr166980395e9.1.1785767451905; Mon, 03 Aug 2026 07:30:51 -0700 (PDT) Received: from fedora ([202.47.63.86]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-49807b98284sm236575295e9.12.2026.08.03.07.30.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Aug 2026 07:30:51 -0700 (PDT) From: Muhammad Bilal To: platform-driver-x86@vger.kernel.org Cc: jorge.lopez2@hp.com, hansg@kernel.org, ilpo.jarvinen@linux.intel.com, linux@weissschuh.net, linux-kernel@vger.kernel.org, meatuni001@gmail.com, stable@vger.kernel.org Subject: [PATCH 01/13] platform/x86: hp-bioscfg: fix off-by-one write in hp_get_string_from_buffer Date: Mon, 3 Aug 2026 19:30:24 +0500 Message-ID: <20260803143037.93105-2-meatuni001@gmail.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260803143037.93105-1-meatuni001@gmail.com> References: <20260803143037.93105-1-meatuni001@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit hp_get_string_from_buffer() clamps the converted string length against the destination buffer size with "size > dst_size", so when the converted length is exactly equal to dst_size, conv_dst_size is left at dst_size and the unconditional NUL terminator write dst[conv_dst_size] = 0; lands one byte past the destination buffer. This is the same shape of bug as the previously fixed off-by-one in hp_convert_hexstr_to_str(): the buffer is sized correctly for the content, but the terminator write is never checked against that size. Fix by changing the comparison to ">=" so conv_dst_size is always left with room for the terminator. All fixed-size destinations that reach this function (path[512], current_value[512], current_password/current_value[64], and the per-entry buffers in encodings[][512] and prerequisites[][512]) are affected. Fixes: a34fc329b189 ("platform/x86: hp-bioscfg: bioscfg") Cc: stable@vger.kernel.org Signed-off-by: Muhammad Bilal --- drivers/platform/x86/hp/hp-bioscfg/bioscfg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/platform/x86/hp/hp-bioscfg/bioscfg.c b/drivers/platform/x86/hp/hp-bioscfg/bioscfg.c index 2bf57e6eade4..0edc6e7cfa9a 100644 --- a/drivers/platform/x86/hp/hp-bioscfg/bioscfg.c +++ b/drivers/platform/x86/hp/hp-bioscfg/bioscfg.c @@ -85,7 +85,7 @@ int hp_get_string_from_buffer(u8 **buffer, u32 *buffer_size, char *dst, u32 dst_ * bytes. */ conv_dst_size = size; - if (size > dst_size) + if (size >= dst_size) conv_dst_size = dst_size - 1; /* -- 2.55.0