projects
/
platform
/
kernel
/
linux-rpi.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
dec6119
)
efi/printf: Handle null string input
author
Arvind Sankar
<nivedita@alum.mit.edu>
Mon, 18 May 2020 19:07:05 +0000
(15:07 -0400)
committer
Ard Biesheuvel
<ardb@kernel.org>
Tue, 19 May 2020 08:31:50 +0000
(10:31 +0200)
Print "(null)" for 's' if the input is a NULL pointer.
Signed-off-by: Arvind Sankar <nivedita@alum.mit.edu>
Link:
https://lore.kernel.org/r/20200518190716.751506-14-nivedita@alum.mit.edu
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
drivers/firmware/efi/libstub/vsprintf.c
patch
|
blob
|
history
diff --git
a/drivers/firmware/efi/libstub/vsprintf.c
b/drivers/firmware/efi/libstub/vsprintf.c
index 27685c726c6400b47d34ad7843def9959ca7ebb8..d427a7b1ef64b23e92fb104c71888fa1e54c62d6 100644
(file)
--- a/
drivers/firmware/efi/libstub/vsprintf.c
+++ b/
drivers/firmware/efi/libstub/vsprintf.c
@@
-14,6
+14,7
@@
#include <linux/compiler.h>
#include <linux/ctype.h>
+#include <linux/limits.h>
#include <linux/string.h>
static int skip_atoi(const char **s)
@@
-356,7
+357,11
@@
int vsprintf(char *buf, const char *fmt, va_list ap)
continue;
case 's':
+ if (precision < 0)
+ precision = INT_MAX;
s = va_arg(args, char *);
+ if (!s)
+ s = precision < 6 ? "" : "(null)";
len = strnlen(s, precision);
if (!(flags & LEFT))