summaryrefslogtreecommitdiff
path: root/libelf/libelf_data.c
diff options
context:
space:
mode:
authorEd Maste <emaste@FreeBSD.org>2019-06-29 15:27:18 +0000
committerEd Maste <emaste@FreeBSD.org>2019-06-29 15:27:18 +0000
commita5b08c1484eac2c6a65e726f550b3189ff84c6c8 (patch)
tree01cd9d6d76e2c378b391422460c6f233ead08179 /libelf/libelf_data.c
parent2b92b30119ed91ed88f102ba9ecc40cd1c046a65 (diff)
Notes
Diffstat (limited to 'libelf/libelf_data.c')
-rw-r--r--libelf/libelf_data.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/libelf/libelf_data.c b/libelf/libelf_data.c
index fcffd8bd9d1c..968394d9bf9a 100644
--- a/libelf/libelf_data.c
+++ b/libelf/libelf_data.c
@@ -28,7 +28,7 @@
#include "_libelf.h"
-ELFTC_VCSID("$Id: libelf_data.c 3174 2015-03-27 17:13:41Z emaste $");
+ELFTC_VCSID("$Id: libelf_data.c 3737 2019-05-05 14:49:50Z jkoshy $");
int
_libelf_xlate_shtype(uint32_t sht)
@@ -89,8 +89,14 @@ _libelf_xlate_shtype(uint32_t sht)
* OS, processor and user-defined section types) are
* legal, but since we do not know anything more about
* their semantics, we return a type of ELF_T_BYTE.
+ *
+ * The ELF specification uses 32 bit unsigned values for
+ * denoting section types, and defines SHT_HIUSER to be
+ * 0xFFFFFFFFUL (i.e., UINT32_MAX). Consequently, we only
+ * need to check that 'sht' is greater than or equal to
+ * SHT_LOOS.
*/
- if (sht >= SHT_LOOS && sht <= SHT_HIUSER)
+ if (sht >= SHT_LOOS)
return (ELF_T_BYTE);
/*