before the change section_flags_string() ignored unknown section
flags: snprintf() did write numeric value int obuffer, but
"*cp = '\0'" hegated the effect.

The change advances the 'cp' pointer'.

While at it add a '|' separator between known and unknown flags.

Signed-off-by: Sergei Trofimovich <sly...@gentoo.org>
---
 src/elflint.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/elflint.c b/src/elflint.c
index 7b7f7937..8f5227b3 100644
--- a/src/elflint.c
+++ b/src/elflint.c
@@ -2815,9 +2815,11 @@ section_flags_string (GElf_Word flags, char *buf, size_t 
len)
        flags ^= known_flags[cnt].flag;
       }
 
-  if (flags != 0 || cp == buf)
-    snprintf (cp, len - 1, "%" PRIx64, (uint64_t) flags);
-
+  if (flags != 0 || cp == buf) {
+    int r = snprintf (cp, len - 1, "%s%" PRIx64, (cp == buf) ? "" : "|", 
(uint64_t) flags);
+    if (r > 0)
+      cp += r;
+  }
   *cp = '\0';
 
   return buf;
-- 
2.30.0

Reply via email to