diff options
author | Jeremy Harris <jgh146exb@wizmail.org> | 2017-10-06 18:11:22 +0100 |
---|---|---|
committer | Jeremy Harris <jgh146exb@wizmail.org> | 2017-10-06 18:11:22 +0100 |
commit | 81f358daccc6f759456eb1ae0f8e456a9118ca9f (patch) | |
tree | 628655fe39e27c5c1d511cec94ab1b2e093ee4e4 /src | |
parent | 879d7781eef537a60c5d25dca4f196d82aa8443f (diff) |
Better handling of printing NULL pointers
Diffstat (limited to 'src')
-rw-r--r-- | src/src/string.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/src/string.c b/src/src/string.c index 3857e1120..f3bf34315 100644 --- a/src/src/string.c +++ b/src/src/string.c @@ -1366,13 +1366,13 @@ while (*fp != 0) { void * ptr; if (p >= last - 24) { yield = FALSE; goto END_FORMAT; } - /* sprintf() saying "(nil)" for a null pointer doesn't work - on FreeBSD; we get "0xAAAAAAAA". Handle it explicitly. */ + /* sprintf() saying "(nil)" for a null pointer seems unreliable. + Handle it explicitly. */ if ((ptr = va_arg(ap, void *))) { strncpy(newformat, item_start, fp - item_start); newformat[fp - item_start] = 0; - p += sprintf(CS p, newformat, va_arg(ap, void *)); + p += sprintf(CS p, newformat, ptr); } else p += sprintf(CS p, "(nil)"); |