diff --git a/runtime/oblink.c b/runtime/oblink.c index f038ce2..786f2e6 100644 --- a/runtime/oblink.c +++ b/runtime/oblink.c @@ -149,7 +149,8 @@ static void scan_files(void) { if (stdlib) { char buf[128]; - snprintf(buf, 128, "%s%s%s", libdir, DIRSEP, lscript); + if (snprintf(buf, 128, "%s%s%s", libdir, DIRSEP, lscript) < 0) + panic("lscript path truncated"); FILE *fp = fopen(buf, "r"); if (fp == NULL) { perror(buf); @@ -158,7 +159,8 @@ static void scan_files(void) { while (fgets(line, MAXLINE, fp) != NULL) { line[strlen(line)-1] = '\0'; - snprintf(buf, 128, "%s%s%s", libdir, DIRSEP, line); + if (snprintf(buf, 128, "%s%s%s", libdir, DIRSEP, line) < 0) + panic("library path truncated"); scan(must_strdup(buf), TRUE); }