diff options
author | Carsten Haitzler (Rasterman) <raster@rasterman.com> | 2014-08-27 14:29:21 +0900 |
---|---|---|
committer | Carsten Haitzler (Rasterman) <raster@rasterman.com> | 2014-08-27 14:29:21 +0900 |
commit | 3f97906d704863751aabf7ccb41ffe17ea33eebe (patch) | |
tree | bc952e4dc59555f642a1629c457bc2d847b458b2 /src/bin/embryo | |
parent | 33d39beac603ea52958817c9df7b8ee12ab9d247 (diff) | |
download | efl-3f97906d704863751aabf7ccb41ffe17ea33eebe.tar.gz |
embryo_cc - fix bunch of unchecked fseeks
this fixes CID 996788
Diffstat (limited to 'src/bin/embryo')
-rw-r--r-- | src/bin/embryo/embryo_cc_sc6.c | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/src/bin/embryo/embryo_cc_sc6.c b/src/bin/embryo/embryo_cc_sc6.c index 0ae8c4e52c..a6b299d9a4 100644 --- a/src/bin/embryo/embryo_cc_sc6.c +++ b/src/bin/embryo/embryo_cc_sc6.c @@ -830,7 +830,8 @@ assemble(FILE * fout, FILE * fin) if (fseek(fout, publics + count * sizeof(FUNCSTUB), SEEK_SET) < 0) fprintf(stderr, "Error seeking\n"); sc_writebin(fout, &func, sizeof func); - fseek(fout, nameofs, SEEK_SET); + if (fseek(fout, nameofs, SEEK_SET) < 0) + fprintf(stderr, "Error seeking\n"); sc_writebin(fout, sym->name, strlen(sym->name) + 1); nameofs += strlen(sym->name) + 1; count++; @@ -884,9 +885,11 @@ assemble(FILE * fout, FILE * fin) align32(&func.address); align32(&func.nameofs); #endif - fseek(fout, natives + count * sizeof(FUNCSTUB), SEEK_SET); + if (fseek(fout, natives + count * sizeof(FUNCSTUB), SEEK_SET) < 0) + fprintf(stderr, "Error seeking\n"); sc_writebin(fout, &func, sizeof func); - fseek(fout, nameofs, SEEK_SET); + if (fseek(fout, nameofs, SEEK_SET) < 0) + fprintf(stderr, "Error seeking\n"); sc_writebin(fout, alias, strlen(alias) + 1); nameofs += strlen(alias) + 1; count++; @@ -908,9 +911,11 @@ assemble(FILE * fout, FILE * fin) align32(&func.address); align32(&func.nameofs); #endif - fseek(fout, libraries + count * sizeof(FUNCSTUB), SEEK_SET); + if (fseek(fout, libraries + count * sizeof(FUNCSTUB), SEEK_SET) < 0) + fprintf(stderr, "Error seeking\n"); sc_writebin(fout, &func, sizeof func); - fseek(fout, nameofs, SEEK_SET); + if (fseek(fout, nameofs, SEEK_SET) < 0) + fprintf(stderr, "Error seeking\n"); sc_writebin(fout, constptr->name, strlen(constptr->name) + 1); nameofs += strlen(constptr->name) + 1; count++; @@ -931,9 +936,11 @@ assemble(FILE * fout, FILE * fin) align32(&func.address); align32(&func.nameofs); #endif - fseek(fout, pubvars + count * sizeof(FUNCSTUB), SEEK_SET); + if (fseek(fout, pubvars + count * sizeof(FUNCSTUB), SEEK_SET) < 0) + fprintf(stderr, "Error seeking\n"); sc_writebin(fout, &func, sizeof func); - fseek(fout, nameofs, SEEK_SET); + if (fseek(fout, nameofs, SEEK_SET) < 0) + fprintf(stderr, "Error seeking\n"); sc_writebin(fout, sym->name, strlen(sym->name) + 1); nameofs += strlen(sym->name) + 1; count++; @@ -954,9 +961,11 @@ assemble(FILE * fout, FILE * fin) align32(&func.address); align32(&func.nameofs); #endif - fseek(fout, tags + count * sizeof(FUNCSTUB), SEEK_SET); + if (fseek(fout, tags + count * sizeof(FUNCSTUB), SEEK_SET) < 0) + fprintf(stderr, "Error seeking\n"); sc_writebin(fout, &func, sizeof func); - fseek(fout, nameofs, SEEK_SET); + if (fseek(fout, nameofs, SEEK_SET) < 0) + fprintf(stderr, "Error seeking\n"); sc_writebin(fout, constptr->name, strlen(constptr->name) + 1); nameofs += strlen(constptr->name) + 1; count++; @@ -965,13 +974,15 @@ assemble(FILE * fout, FILE * fin) /* write the "maximum name length" field in the name table */ assert(nameofs == nametable + nametablesize); - fseek(fout, nametable, SEEK_SET); + if (fseek(fout, nametable, SEEK_SET) < 0) + fprintf(stderr, "Error seeking\n"); count = sNAMEMAX; #ifdef WORDS_BIGENDIAN align16(&count); #endif sc_writebin(fout, &count, sizeof count); - fseek(fout, cod, SEEK_SET); + if (fseek(fout, cod, SEEK_SET) < 0) + fprintf(stderr, "Error seeking\n"); /* First pass: relocate all labels */ /* This pass is necessary because the code addresses of labels is only known |