From: Mike Frysinger Date: Sat, 31 Oct 2015 04:47:59 +0000 (-0400) Subject: printflags: handle empty xlats X-Git-Tag: v4.11~147 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=79bddff923862fbf4e4d349c714d4c3ea9d14e81;p=strace printflags: handle empty xlats If the set of headers are unable to produce a valid list, printflags will try to pass NULL to tprints which crashes. Add a sanity check for this edge case. * util.c (printflags): Check xlat->str is not NULL. --- diff --git a/util.c b/util.c index c3e3fdaf..5f1f733e 100644 --- a/util.c +++ b/util.c @@ -352,7 +352,7 @@ printflags(const struct xlat *xlat, int flags, const char *dflt) int n; const char *sep; - if (flags == 0 && xlat->val == 0) { + if (flags == 0 && xlat->val == 0 && xlat->str) { tprints(xlat->str); return 1; }