From 03de77f5210addfd2ca2b35137152edfe2ab70be Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Tue, 17 Apr 2012 11:50:02 -0400 Subject: [PATCH] avoid null pointer dereference on %*p fields in scanf --- src/stdio/vfscanf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/stdio/vfscanf.c b/src/stdio/vfscanf.c index 5c1e49b1..926d8a9d 100644 --- a/src/stdio/vfscanf.c +++ b/src/stdio/vfscanf.c @@ -284,7 +284,7 @@ int vfscanf(FILE *f, const char *fmt, va_list ap) int_common: x = __intscan(f, base, 0, ULLONG_MAX); if (!shcnt(f)) goto match_fail; - if (t=='p') *(void **)dest = (void *)(uintptr_t)x; + if (t=='p' && dest) *(void **)dest = (void *)(uintptr_t)x; else store_int(dest, size, x); break; case 'a': case 'A': -- 2.25.1