File 0016-printflags-handle-empty-xlats.patch of Package strace
From 79bddff923862fbf4e4d349c714d4c3ea9d14e81 Mon Sep 17 00:00:00 2001
From: Mike Frysinger <vapier@gentoo.org>
Date: Sat, 31 Oct 2015 00:47:59 -0400
Subject: [PATCH] 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.
---
util.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/util.c b/util.c
index c3e3fda..5f1f733 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;
}
--
2.6.6