89be67
From 26f146f7dcf96f8f0a5b2f0503bdb4c46b74cf56 Mon Sep 17 00:00:00 2001
89be67
From: Christos Zoulas <christos@zoulas.com>
89be67
Date: Wed, 31 Oct 2012 17:03:41 +0000
89be67
Subject: [PATCH] PR/208: Fix buildid format
89be67
89be67
---
89be67
 src/readelf.c | 11 ++++++-----
89be67
 1 file changed, 6 insertions(+), 5 deletions(-)
89be67
89be67
diff --git a/src/readelf.c b/src/readelf.c
89be67
index deb6d31..158f789 100644
89be67
--- a/src/readelf.c
89be67
+++ b/src/readelf.c
89be67
@@ -473,13 +473,14 @@ donote(struct magic_set *ms, void *vbuf, size_t offset, size_t size,
89be67
 
89be67
 	if (namesz == 4 && strcmp((char *)&nbuf[noff], "GNU") == 0 &&
89be67
 	    xnh_type == NT_GNU_BUILD_ID && (descsz == 16 || descsz == 20)) {
89be67
-	    uint32_t desc[5], i;
89be67
-	    if (file_printf(ms, ", BuildID[%s]=0x", descsz == 16 ? "md5/uuid" :
89be67
+	    uint8_t desc[20];
89be67
+	    uint32_t i;
89be67
+	    if (file_printf(ms, ", BuildID[%s]=", descsz == 16 ? "md5/uuid" :
89be67
 		"sha1") == -1)
89be67
 		    return size;
89be67
 	    (void)memcpy(desc, &nbuf[doff], descsz);
89be67
-	    for (i = 0; i < descsz >> 2; i++)
89be67
-		if (file_printf(ms, "%.8x", desc[i]) == -1)
89be67
+	    for (i = 0; i < descsz; i++)
89be67
+		if (file_printf(ms, "%02x", desc[i]) == -1)
89be67
 		    return size;
89be67
 	    *flags |= FLAGS_DID_BUILD_ID;
89be67
 	}