summaryrefslogtreecommitdiff
path: root/ao-tools/ao-elftohex/ao-elftohex.c
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2017-04-09 12:48:54 -0700
committerBdale Garbee <bdale@gag.com>2017-04-22 11:52:34 -0600
commitf036b35a6fe1e187b2faea5c4ddf72359b33a44f (patch)
treeb92c0efe9e495805489310c3e162b138b357cb01 /ao-tools/ao-elftohex/ao-elftohex.c
parent1db7169b193808c733852054e9a4713cdbd76cea (diff)
ao-elftohex: Add conditions for skipping ELF sections
Skip sections with size 0, or which are of type SHT_NOBITS or which don't have the SHF_ALLOC flag set. This avoids crashing on sections which don't have any data to copy. Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'ao-tools/ao-elftohex/ao-elftohex.c')
-rw-r--r--ao-tools/ao-elftohex/ao-elftohex.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/ao-tools/ao-elftohex/ao-elftohex.c b/ao-tools/ao-elftohex/ao-elftohex.c
index 265908c5..f3ab0c38 100644
--- a/ao-tools/ao-elftohex/ao-elftohex.c
+++ b/ao-tools/ao-elftohex/ao-elftohex.c
@@ -19,6 +19,7 @@
#include <getopt.h>
#include <stdlib.h>
#include <string.h>
+#include <unistd.h>
#include "ao-hex.h"
#include "ao-elf.h"
#include "ao-verbose.h"