From c6eb5bc967d3d70016b4e4e182b3d68b1e558f60 Mon Sep 17 00:00:00 2001 From: Benoît Ganne Date: Fri, 26 Apr 2019 11:09:49 +0200 Subject: elf: fix memcmp() overflow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit name can be (and will be) smaller than section_name_start. Both name and section_name_start are NULL-terminated so we can use strcmp. Change-Id: Iec414810109f9267de20c25c0fe601df35daf89e Signed-off-by: Benoît Ganne --- src/vppinfra/elf_clib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/vppinfra') diff --git a/src/vppinfra/elf_clib.c b/src/vppinfra/elf_clib.c index 7bb72ee3e3f..2bc05e1d8d4 100644 --- a/src/vppinfra/elf_clib.c +++ b/src/vppinfra/elf_clib.c @@ -153,7 +153,7 @@ clib_elf_parse_file (clib_elf_main_t * cem, clib_elf_section_bounds_t *b; /* Section name must begin with CLIB_ELF_SECTION key. */ - if (memcmp (name, section_name_start, section_name_start_len)) + if (strcmp ((char *) name, section_name_start)) continue; name += section_name_start_len; -- cgit 1.2.3-korg