summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/port/snprintf.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/port/snprintf.c b/src/port/snprintf.c
index 55e80d90f23..402cb2245ff 100644
--- a/src/port/snprintf.c
+++ b/src/port/snprintf.c
@@ -775,6 +775,9 @@ nextch2:
strvalue = argvalues[fmtpos].cptr;
else
strvalue = va_arg(args, char *);
+ /* If string is NULL, silently substitute "(null)" */
+ if (strvalue == NULL)
+ strvalue = "(null)";
fmtstr(strvalue, leftjust, fieldwidth, precision, pointflag,
target);
break;