summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShinwoo Kim <cinoo.kim@samsung.com>2020-08-05 14:52:50 +0900
committerShinwoo Kim <cinoo.kim@samsung.com>2020-08-05 14:53:35 +0900
commitbab3f870b8150e05cf2b778e67b1f6be326874a7 (patch)
treea9fcc8369f9f3e4ad5d4cb66c3df63484d36b603
parent26b50c91f803d9669edfbc2ab6bad664f86f33a8 (diff)
downloadefl-bab3f870b8150e05cf2b778e67b1f6be326874a7.tar.gz
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
-rw-r--r--src/bin/embryo/embryo_cc_sc1.c9
1 files 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);