From 7516f2bc331634fbd4e9a96baa9c50d058179259 Mon Sep 17 00:00:00 2001 From: David Levine Date: Wed, 31 Oct 2018 19:09:33 -0400 Subject: [PATCH] Resized buffer, and moved it to the only block where it's used. gcc 8 noticed that snprintf could have overrun it. --- uip/whatnowsbr.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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; -- 2.56.0