From: David Levine Date: Wed, 31 Oct 2018 23:09:33 +0000 (-0400) Subject: Resized buffer, and moved it to the only block where it's used. X-Git-Url: https://diplodocus.org/git/nmh/commitdiff_plain/7516f2bc331634fbd4e9a96baa9c50d058179259?ds=inline;hp=-c Resized buffer, and moved it to the only block where it's used. gcc 8 noticed that snprintf could have overrun it. --- 7516f2bc331634fbd4e9a96baa9c50d058179259 diff --git a/uip/whatnowsbr.c b/uip/whatnowsbr.c index e1729df7..945afbab 100644 --- a/uip/whatnowsbr.c +++ b/uip/whatnowsbr.c @@ -156,7 +156,6 @@ WhatNow (int argc, char **argv) char **argp, **arguments; struct stat st; char cwd[PATH_MAX + 1]; /* current working directory */ - char file[PATH_MAX + 1]; /* file name buffer */ char shell[PATH_MAX + 1]; /* shell response buffer */ FILE *f; /* read pointer for bgnd proc */ char *l; /* set on -l to alist command */ @@ -450,6 +449,8 @@ WhatNow (int argc, char **argv) */ if ((f = popen_in_dir(cwd, buf, "r")) != NULL) { + char file[2 * PATH_MAX + 2]; /* file name buffer */ + while (fgets(shell, sizeof (shell), f) != NULL) { char *ctype;