diff options
author | Takashi Iwai <tiwai@suse.de> | 2020-04-09 15:04:26 +0200 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2020-04-14 08:32:11 +0200 |
commit | b450b30b97010e5c68ab522c6f6c54ef76bd0683 (patch) | |
tree | f8d6491f8bf1f1e867d50537b6606064419e2f33 /drivers/firmware | |
parent | 8f3d9f354286745c751374f5f1fcafee6b3f3136 (diff) | |
download | linux-b450b30b97010e5c68ab522c6f6c54ef76bd0683.tar.gz linux-b450b30b97010e5c68ab522c6f6c54ef76bd0683.tar.bz2 linux-b450b30b97010e5c68ab522c6f6c54ef76bd0683.zip |
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@suse.de>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Ingo Molnar <mingo@kernel.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
Diffstat (limited to 'drivers/firmware')
-rw-r--r-- | drivers/firmware/efi/cper.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/firmware/efi/cper.c b/drivers/firmware/efi/cper.c index b1af0de2e100..9d2512913d25 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); |