Better handling of printing NULL pointers
[exim.git] / src / src / string.c
index 3857e1120c1bf3b9002597a72477e4c1bb5e251c..f3bf343150b499b4135587808f14774ae7540ba0 100644 (file)
@@ -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)");