diff options
| author | Ulf Hermann <[email protected]> | 2017-04-20 16:40:30 +0200 |
|---|---|---|
| committer | Mark Wielaard <[email protected]> | 2017-04-27 20:19:54 +0200 |
| commit | d6655d9995e3fa9a2318261ec3ef5fc54996f69c (patch) | |
| tree | 9ae1dac6f6fb6fe2479d944b47493b1dff84d026 /libdwfl/elf-from-memory.c | |
| parent | efd60bee71b9613a97bf60fa4f8d4407f8460ccb (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.
Signed-off-by: Ulf Hermann <[email protected]>
Diffstat (limited to 'libdwfl/elf-from-memory.c')
| -rw-r--r-- | libdwfl/elf-from-memory.c | 2 |
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) |
