PPP, from PPPD upstream, Don't crash if NULL pointer passed to vslprintf for %q or %v

pppd: Don't crash if NULL pointer passed to vslprintf for %q or %v

This is to avoid crashes like that reported in
https://bugs.launchpad.net/ubuntu/+source/ppp/+bug/1244714
This commit is contained in:
Sylvain Rochet 2014-04-15 22:50:53 +02:00
parent f6d56e2937
commit c31b03327f

View File

@ -283,6 +283,8 @@ int ppp_vslprintf(char *buf, int buflen, char *fmt, va_list 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 {