lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <158685245232.28353.13426564371942853685.tip-bot2@tip-bot2>
Date:   Tue, 14 Apr 2020 08:20:52 -0000
From:   "tip-bot2 for Takashi Iwai" <tip-bot2@...utronix.de>
To:     linux-tip-commits@...r.kernel.org
Cc:     Takashi Iwai <tiwai@...e.de>, Ard Biesheuvel <ardb@...nel.org>,
        Ingo Molnar <mingo@...nel.org>, x86 <x86@...nel.org>,
        LKML <linux-kernel@...r.kernel.org>
Subject: [tip: efi/urgent] efi/cper: Use scnprintf() for avoiding potential
 buffer overflow

The following commit has been merged into the efi/urgent branch of tip:

Commit-ID:     b450b30b97010e5c68ab522c6f6c54ef76bd0683
Gitweb:        https://git.kernel.org/tip/b450b30b97010e5c68ab522c6f6c54ef76bd0683
Author:        Takashi Iwai <tiwai@...e.de>
AuthorDate:    Thu, 09 Apr 2020 15:04:26 +02:00
Committer:     Ingo Molnar <mingo@...nel.org>
CommitterDate: Tue, 14 Apr 2020 08:32:11 +02:00

efi/cper: Use scnprintf() for avoiding potential buffer overflow

Since snprintf() returns the would-be-output size instead of the
actual output size, the succeeding calls may go beyond the given
buffer limit.  Fix it by replacing with scnprintf().

Signed-off-by: Takashi Iwai <tiwai@...e.de>
Signed-off-by: Ard Biesheuvel <ardb@...nel.org>
Signed-off-by: Ingo Molnar <mingo@...nel.org>
Link: https://lore.kernel.org/r/20200311072145.5001-1-tiwai@suse.de
Link: https://lore.kernel.org/r/20200409130434.6736-2-ardb@kernel.org
---
 drivers/firmware/efi/cper.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/firmware/efi/cper.c b/drivers/firmware/efi/cper.c
index b1af0de..9d25129 100644
--- a/drivers/firmware/efi/cper.c
+++ b/drivers/firmware/efi/cper.c
@@ -101,7 +101,7 @@ void cper_print_bits(const char *pfx, unsigned int bits,
 		if (!len)
 			len = snprintf(buf, sizeof(buf), "%s%s", pfx, str);
 		else
-			len += snprintf(buf+len, sizeof(buf)-len, ", %s", str);
+			len += scnprintf(buf+len, sizeof(buf)-len, ", %s", str);
 	}
 	if (len)
 		printk("%s\n", buf);

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ