Author: tsoome Date: Mon Nov 4 06:35:48 2019 New Revision: 354330 URL: https://svnweb.freebsd.org/changeset/base/354330
Log: MFC r354237: loader: asprinf does crash arm64 due to missing NULL pointer check PCHAR macro needs to check if d is NULL. Modified: stable/12/stand/libsa/printf.c Directory Properties: stable/12/ (props changed) Modified: stable/12/stand/libsa/printf.c ============================================================================== --- stable/12/stand/libsa/printf.c Mon Nov 4 06:16:00 2019 (r354329) +++ stable/12/stand/libsa/printf.c Mon Nov 4 06:35:48 2019 (r354330) @@ -247,7 +247,17 @@ ksprintn(char *nbuf, uintmax_t num, int base, int *len static int kvprintf(char const *fmt, kvprintf_fn_t *func, void *arg, int radix, va_list ap) { -#define PCHAR(c) {int cc=(c); if (func) (*func)(cc, arg); else *d++ = cc; retval++; } +#define PCHAR(c) { \ + int cc = (c); \ + \ + if (func) { \ + (*func)(cc, arg); \ + } else if (d != NULL) { \ + *d++ = cc; \ + } \ + retval++; \ + } + char nbuf[MAXNBUF]; char *d; const char *p, *percent, *q; _______________________________________________ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"