From patchwork Thu Mar 9 02:12:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Liu X-Patchwork-Id: 661035 Delivered-To: patch@linaro.org Received: by 2002:adf:a3c6:0:0:0:0:0 with SMTP id m6csp80997wrb; Wed, 8 Mar 2023 18:13:00 -0800 (PST) X-Google-Smtp-Source: AK7set/LJnJU+GQHfIN1CrCYoSl8pCgMLkh8NXCqE+Urr6OBFhfN1jBW2HtGVFpjSyUen2VKU51e X-Received: by 2002:a9d:6d16:0:b0:68b:bd49:36e9 with SMTP id o22-20020a9d6d16000000b0068bbd4936e9mr8904451otp.30.1678327980509; Wed, 08 Mar 2023 18:13:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678327980; cv=none; d=google.com; s=arc-20160816; b=guTaQI2NO4fT2kSedQ/phrxk6u/kqyqDJZfCaWzt0QMr8WaiVQ2X4scNHE2vsbVkA5 Ldd0YcENlw83W36QaB/YdKAXIZtjftQEIA53/kU+JUdxT+bRmWArxWeIc+tIJUxRQgMy cWR0D+lSE8HoCGAjj+3cCuGRC1FShUHpi1AbtQ5F2YNd5KpWXKxE340gSFNYmtWvRWGF cavxqZzcCinkfP8bkJSLys3BHSa4tXLHDkqOV01T7FCK5Bh9+5CjNeYzJLIKXyrhPRgK wP/q359CpPJ5qxg26dLbRlcfSedDYp+C20OntGUXka680wnluH7EOTM6gVUNmIsXGY3y dNNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature; bh=/K5OdgsKGNkDWTtkg4G7Ta34lotptpN2ECLg7hAbIZk=; b=Vs79ad3fsebHAOXZyR19/EpkZ45NK0cuZoPdqjPTTVM8QfURmkj/bsWCcZgeXH1D0r 2+3VDPkT4Nvv4C6FwF0O6C1PtZKvky7EmTLCaY5V7y4ITnDkoAsZIlTqGqir55IUMRD4 fuA0eNa4SzD8C5BkF1Ml+ecBsLWr9xQTQFdtVApbWV2wXvZS157Dot69B5/xiX+f4FGj FHXjMxNhQLk66z2joadvP8fAcyL7l5rDMD5uQTMUE4Yp4RJtx8IgG6zAr5JMpCVksgLq jLTRiK9AY2HEQKt9RE2XmIV0Uyr6KYZj/ku+NwMN8zxEflHEovpn5yBzMyKQwg14C3cr Kzww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GFxtJW8S; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id p24-20020a056830131800b0068dc4cc539esi16868845otq.246.2023.03.08.18.12.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Mar 2023 18:13:00 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GFxtJW8S; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3099A85DA9; Thu, 9 Mar 2023 03:12:45 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="GFxtJW8S"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 01FBF85D87; Thu, 9 Mar 2023 03:12:38 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,T_SPF_TEMPERROR autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pj1-x1033.google.com (mail-pj1-x1033.google.com [IPv6:2607:f8b0:4864:20::1033]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 8343385D08 for ; Thu, 9 Mar 2023 03:12:30 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=paul.liu@linaro.org Received: by mail-pj1-x1033.google.com with SMTP id h11-20020a17090a2ecb00b00237c740335cso726046pjs.3 for ; Wed, 08 Mar 2023 18:12:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678327948; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=/K5OdgsKGNkDWTtkg4G7Ta34lotptpN2ECLg7hAbIZk=; b=GFxtJW8SsNs4j2VbJi4Pt0tjicsULbe4yOC6iNFlFfOkL+VCcR8/gh7okAgCkSDQ8S EVM8evqvnwy1dFuhI1M1tmJz1VzWO2mwmbZIdVgACXXChnsgrd0H7S51Wpz7mNuayO6m BugznERlkHFX9f31d8PgfSCYd4/of+/lxJNXBbB5SAhhEYxBoCM5YqTFJTgepGVFmt/i T60IzoialyVIZ6JGqb7Zld1CraDP9cizKOlmf1W0MRNDwb3C6EJ/zSY8F9VrCBOi9jqC YJfl1QpjlhpDUDNiq2y+xIK0yrCgblygTqTz8i9dl70BrJBIxFG4gnl62ICsSvkdGO1W NtYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678327948; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=/K5OdgsKGNkDWTtkg4G7Ta34lotptpN2ECLg7hAbIZk=; b=JgOO0FDgdkcjZVJzUV4RLenHFfhR/FHSTC9R19SNz3fqQq90Mae9TC3Z6Av0asRY2G bJNNm4uLEXw6l0qqhujNJez5lYQz7fZzvhHxsOckKtrH0AYyEQoAgzxOEJwUd9+lssuE vDBdsyLL8TTOSxHtau4tFs/N5itrBcbMXxECJJLMkIWoJ8Sthn5U6vw94CQAgHCWhCb9 bOgWd+C2RnT6ZP+7FjAQC2ZsEmyWuaTlarBekwTs+BAyhTdmtoJSvC3KgR30ATuwGRNS Wc/j59Uzs4O0SP//22vmSPTPEVLyufVYRQJgmckm/MadEUR8vIg5BhLhHFLGNAflGieR AgRQ== X-Gm-Message-State: AO0yUKVUcmzUk+TDF4Fqj12kGRmyYV0JIijEvIw7r5kJ7tRDUBCXwKR6 pMXLObxV1eKgjh8nYMLYmpMcnZkmU+KF8aJPp5Y= X-Received: by 2002:a17:90b:4d8f:b0:233:fa78:7c9e with SMTP id oj15-20020a17090b4d8f00b00233fa787c9emr20720753pjb.12.1678327948477; Wed, 08 Mar 2023 18:12:28 -0800 (PST) Received: from localhost ([111.184.129.17]) by smtp.gmail.com with ESMTPSA id g5-20020a17090adac500b002375c356b0csm410833pjx.19.2023.03.08.18.12.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Mar 2023 18:12:27 -0800 (PST) From: "Ying-Chun Liu (PaulLiu)" To: u-boot@lists.denx.de Cc: "Ying-Chun Liu (PaulLiu)" Subject: [PATCH 0/1] lib/vsprintf.c: fix integer overflow in vsprintf Date: Thu, 9 Mar 2023 10:12:20 +0800 Message-Id: <20230309021221.306044-1-paul.liu@linaro.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean vsnprintf_internal() adds 'size' to 'buf' and vsprintf() sets 'size' to 'INT_MAX' which can overflow. This causes sprintf() to fail when initializing the environment on 8GB. Instead of using 'INT_MAX', we use SIZE_MAX - buf, which is the largest possible string that could fit without overflowing 'size'. Tom Cherry (1): lib/vsprintf.c: fix integer overflow in vsprintf lib/vsprintf.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)