Commit b450b30b authored by Takashi Iwai's avatar Takashi Iwai Committed by Ingo Molnar

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: default avatarTakashi Iwai <>
Signed-off-by: default avatarArd Biesheuvel <>
Signed-off-by: default avatarIngo Molnar <>
parent 8f3d9f35
......@@ -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);
len += snprintf(buf+len, sizeof(buf)-len, ", %s", str);
len += scnprintf(buf+len, sizeof(buf)-len, ", %s", str);
if (len)
printk("%s\n", buf);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment