diff options
| author | Quentin Carbonneaux | 2015-03-08 18:36:05 -0400 |
|---|---|---|
| committer | Quentin Carbonneaux | 2015-03-08 18:36:05 -0400 |
| commit | 2a5520292ac887d9cc7360467673f375fac6286a (patch) | |
| tree | 06c31fef9ee55dfea71a19f73f139c60c5183a0f | |
| parent | 4b9a7badce5c318a1e6d48c3805773166d4015f9 (diff) | |
make it standard C89
| -rw-r--r-- | miniyacc.c | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -1239,14 +1239,16 @@ init(int ac, char *av[]) if (!(srca = *av)) goto usage; fin = fopen(srca, "r"); - snprintf(buf, 100, "%s.tab.c", pref); + if (strlen(pref) + 10 > sizeof buf) + die("-b prefix too long"); + sprintf(buf, "%s.tab.c", pref); fout = fopen(buf, "w"); if (vf) { - snprintf(buf, 100, "%s.output", pref); + sprintf(buf, "%s.output", pref); fgrm = fopen(buf, "w"); } if (df) { - snprintf(buf, 100, "%s.tab.h", pref); + sprintf(buf, "%s.tab.h", pref); fhdr = fopen(buf, "w"); if (fhdr) { fprintf(fhdr, "#ifndef Y_TAB_H_\n"); |
