From c109e92962dabf9dbd9468346d0fc4354e562bae Mon Sep 17 00:00:00 2001 From: Yasuhiro Osaki Date: Fri, 8 May 2015 14:00:59 +0900 Subject: [PATCH] binfmt: Fix offset value when calling elf_read() in elf_sectname() Jira: PDFW15IS-3030 Signed-off-by: Masayuki Ishikawa --- binfmt/libelf/libelf_sections.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/binfmt/libelf/libelf_sections.c b/binfmt/libelf/libelf_sections.c index 8f4369d367..6f58b4a318 100644 --- a/binfmt/libelf/libelf_sections.c +++ b/binfmt/libelf/libelf_sections.c @@ -114,7 +114,6 @@ static inline int elf_sectname(FAR struct elf_loadinfo_s *loadinfo, /* Loop until we get the entire section name into memory */ - buffer = loadinfo->iobuffer; bytesread = 0; for (; ; ) @@ -136,7 +135,7 @@ static inline int elf_sectname(FAR struct elf_loadinfo_s *loadinfo, /* Read that number of bytes into the array */ buffer = &loadinfo->iobuffer[bytesread]; - ret = elf_read(loadinfo, buffer, readlen, offset); + ret = elf_read(loadinfo, buffer, readlen, offset + bytesread); if (ret < 0) { berr("Failed to read section name\n");