From bab3f870b8150e05cf2b778e67b1f6be326874a7 Mon Sep 17 00:00:00 2001 From: Shinwoo Kim Date: Wed, 5 Aug 2020 14:52:50 +0900 Subject: [PATCH] embryo_cc: ++safty code Summary: This patch is increasing safty code by handling following case. sc_compile > OH!! there is uninitialized loacal variable "outfname"!! > setopt > about > longjmp > setjmp returns 3 > goto cleanup > then uninitialized data is read from local variable "outfname". Reviewers: raster, Hermet, jsuya, herb Reviewed By: jsuya Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D12074 --- src/bin/embryo/embryo_cc_sc1.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/bin/embryo/embryo_cc_sc1.c b/src/bin/embryo/embryo_cc_sc1.c index 7595be8299..8f25be75b5 100644 --- a/src/bin/embryo/embryo_cc_sc1.c +++ b/src/bin/embryo/embryo_cc_sc1.c @@ -266,7 +266,7 @@ sc_compile(int argc, char *argv[]) void *inpfmark; char lcl_ctrlchar; int lcl_packstr, lcl_needsemicolon, lcl_tabsize; - Eina_Tmpstr *outfname; + Eina_Tmpstr *outfname = NULL; /* set global variables to their initial value */ binf = NULL; @@ -398,8 +398,11 @@ sc_compile(int argc, char *argv[]) } /* if */ if (outf) sc_closeasm(outf); - unlink(outfname); - eina_tmpstr_del(outfname); + if (outfname) + { + unlink(outfname); + eina_tmpstr_del(outfname); + } if (binf) sc_closebin(binf, errnum != 0);