]> git.ozlabs.org Git - ppp.git/commitdiff
pppd: Don't crash if NULL pointer passed to vslprintf for %q or %v
authorPaul Mackerras <paulus@samba.org>
Thu, 2 Jan 2014 04:00:12 +0000 (15:00 +1100)
committerPaul Mackerras <paulus@samba.org>
Thu, 2 Jan 2014 04:00:12 +0000 (15:00 +1100)
This is to avoid crashes like that reported in
https://bugs.launchpad.net/ubuntu/+source/ppp/+bug/1244714

Signed-off-by: Paul Mackerras <paulus@samba.org>
pppd/utils.c

index 6cf80fe3d229a2fab28ec00dd4b9149e0e11279f..29bf970905d58ffdcba9fe68cc7c62526fc9430e 100644 (file)
@@ -296,6 +296,8 @@ vslprintf(buf, buflen, fmt, args)
        case 'q':               /* quoted string */
            quoted = c == 'q';
            p = va_arg(args, unsigned char *);
+           if (p == NULL)
+                   p = (unsigned char *)"<NULL>";
            if (fillch == '0' && prec >= 0) {
                n = prec;
            } else {