summaryrefslogtreecommitdiffstats
path: root/libdwfl/elf-from-memory.c
diff options
context:
space:
mode:
authorUlf Hermann <[email protected]>2017-04-07 15:57:37 +0200
committerUlf Hermann <[email protected]>2017-04-26 13:06:36 +0000
commitbb8bd71deb85ce7818fa747c3297d4b0ed7cf367 (patch)
treefdb700765325c665dc68a8e4b0b7e1f307db3541 /libdwfl/elf-from-memory.c
parentdd25560eb6973014066321821060b5cec18204a4 (diff)
Avoid signed/unsigned comparison
Some compilers implicitly cast the result of uint_fast16_t * uint_fast16_t to something signed and then complain about the comparison to (unsigned) size_t. Casting phnum to size_t is a good idea anyway as 16bit multiplication can easily overflow and we are not checking for this. Change-Id: I073202d433d75b540ca042d15c364187a08fec6c Reviewed-by: Christian Kandeler <[email protected]>
Diffstat (limited to 'libdwfl/elf-from-memory.c')
-rw-r--r--libdwfl/elf-from-memory.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libdwfl/elf-from-memory.c b/libdwfl/elf-from-memory.c
index dd42e954..12a0a1be 100644
--- a/libdwfl/elf-from-memory.c
+++ b/libdwfl/elf-from-memory.c
@@ -172,7 +172,7 @@ elf_from_remote_memory (GElf_Addr ehdr_vma,
{
/* Read in the program headers. */
- if (initial_bufsize < phnum * phentsize)
+ if (initial_bufsize < (size_t)phnum * phentsize)
{
unsigned char *newbuf = realloc (buffer, phnum * phentsize);
if (newbuf == NULL)