about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2012-04-17 11:50:02 -0400
committerRich Felker <dalias@aerifal.cx>2012-04-17 11:50:02 -0400
commit03de77f5210addfd2ca2b35137152edfe2ab70be (patch)
tree7b6b78365ab03fa2883b4968a31f6f4b93b1e086
parentb7a2761780c28cd0167ce4e51623e42298096708 (diff)
downloadmusl-03de77f5210addfd2ca2b35137152edfe2ab70be.tar.gz
musl-03de77f5210addfd2ca2b35137152edfe2ab70be.tar.xz
musl-03de77f5210addfd2ca2b35137152edfe2ab70be.zip
avoid null pointer dereference on %*p fields in scanf
-rw-r--r--src/stdio/vfscanf.c2
1 files changed, 1 insertions, 1 deletions
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':