crash-stack: Fix handle leak 83/75183/2 accepted/tizen/common/20160622.145838 accepted/tizen/ivi/20160623.120707 accepted/tizen/mobile/20160623.120615 accepted/tizen/tv/20160623.120631 accepted/tizen/wearable/20160623.120649 submit/tizen/20160622.011710
authorSunmin Lee <sunm.lee@samsung.com>
Fri, 17 Jun 2016 03:49:47 +0000 (12:49 +0900)
committerSunmin Lee <sunm.lee@samsung.com>
Wed, 22 Jun 2016 00:28:15 +0000 (09:28 +0900)
Fix vulnerablility caused by handle leak of file.

Change-Id: I037f547633f1d7f074eb63a5dcad2d9b921bfc1a
Signed-off-by: Sunmin Lee <sunm.lee@samsung.com>
src/crash-stack/crash-stack.c

index 76ce25d..a9e5b2d 100644 (file)
@@ -169,8 +169,10 @@ static char *try_symbol_from_elfs (Elf *core, Elf_Data *notes, uintptr_t address
 
             elf = elf_begin (fd, ELF_C_READ_MMAP, NULL);
 
-            if (NULL == elf)
+            if (NULL == elf) {
+              close(fd);
               return NULL;
+            }
 
             Elf_Scn *scn = NULL;
             *module_name = filenames;