summaryrefslogtreecommitdiff
path: root/src/bin/embryo
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2014-09-01 19:05:50 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2014-09-01 19:40:46 +0900
commit88fda07299e3569be8b9b64c4c6e95652d845679 (patch)
tree61d9b872a1ffb3ed6dc0cf0e204c9950944e4bba /src/bin/embryo
parent09648f6cf1a8db5640a8e25e1be8c6a6c69c4f7a (diff)
embryo_cc - fix possible buffer overrun
fix CID 1039590
Diffstat (limited to 'src/bin/embryo')
-rw-r--r--src/bin/embryo/embryo_cc_sc1.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/bin/embryo/embryo_cc_sc1.c b/src/bin/embryo/embryo_cc_sc1.c
index b97e199950..15049f9834 100644
--- a/src/bin/embryo/embryo_cc_sc1.c
+++ b/src/bin/embryo/embryo_cc_sc1.c
@@ -3803,12 +3803,14 @@ doswitch(void)
3803 if (swdefault == FALSE) 3803 if (swdefault == FALSE)
3804 { 3804 {
3805 /* store lbl_exit as the "none-matched" label in the switch table */ 3805 /* store lbl_exit as the "none-matched" label in the switch table */
3806 strcpy(labelname, itoh(lbl_exit)); 3806 strncpy(labelname, itoh(lbl_exit), sizeof(labelname) - 1);
3807 labelname[sizeof(labelname) - 1] = 0;
3807 } 3808 }
3808 else 3809 else
3809 { 3810 {
3810 /* lbl_case holds the label of the "default" clause */ 3811 /* lbl_case holds the label of the "default" clause */
3811 strcpy(labelname, itoh(lbl_case)); 3812 strncpy(labelname, itoh(lbl_case), sizeof(labelname) - 1);
3813 labelname[sizeof(labelname) - 1] = 0;
3812 } /* if */ 3814 } /* if */
3813 ffcase(casecount, labelname, TRUE); 3815 ffcase(casecount, labelname, TRUE);
3814 /* generate the rest of the table */ 3816 /* generate the rest of the table */