libblkid: fix overflow in implicit constant conversion
PATCH 1/1 libblkid: fix overflow in implicit constant conversion
Signed-off-by Sami Kerola <[email protected]>
--- libblkid/src/superblocks/bcache.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
libblkid/src/superblocks/bcache.c +2 -1
@@ -10,6 +10,7 @@#include <stddef.h> #include <stdio.h> +#include <stdint.h> #include "superblocks.h"
@@ -19,7 +20,7 @@#define node (i, j) ((i)->d + (j))#define end (i) node(i, le16_to_cpu((i)->keys)) -static const char bcache_magic[] = { +static const uint8_t bcache_magic[] = {0xc6 ,0x85 ,0x73 ,0xf6 ,0x4e ,0x1a ,0x45 ,0xca ,0x82 ,0x65 ,0xf5 ,0x7f ,0x48 ,0xba ,0x6d ,0x81 };
Signature · 1 line
2.15.1
Karel Zak
maintainerlibblkid/src/superblocks/bcache.c line 26
Quoted 5 lines · Sami Kerola
libblkid/src/superblocks/bcache.c +1
-1-static const char bcache_magic[] = { +static const uint8_t bcache_magic[] = {0xc6 ,0x85 ,0x73 ,0xf6 ,0x4e ,0x1a ,0x45 ,0xca ,0x82 ,0x65 ,0xf5 ,0x7f ,0x48 ,0xba ,0x6d ,0x81 };
Well, libblkid assumes magic number as a string, and it seems we do not need the variable bcache_magic[] in the code at all. So I have committed:
-#define BCACHE_SB_MAGIC bcache_magic
+#define BCACHE_SB_MAGIC "\xc6\x85\x73\xf6\x4e\x1a\x45\xca\x82\x65\xf5\x7f\x48\xba\x6d\x81"
etc.
Karel
Signature · 2 lines
Karel Zak <[email protected]> http://karelzak.blogspot.com