diff options
-rw-r--r-- | editors/jove/patches/patch-proc.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/editors/jove/patches/patch-proc.c b/editors/jove/patches/patch-proc.c new file mode 100644 index 00000000000..504aa8cee01 --- /dev/null +++ b/editors/jove/patches/patch-proc.c @@ -0,0 +1,29 @@ +# $NetBSD: patch-proc.c,v 1.1 2019/09/06 14:51:42 christos Exp $ + +Don't smash the stack by using the same variable for input and output. + +--- proc.c 2015-10-15 14:12:25.000000000 -0400 ++++ proc.c 2019-09-06 10:20:35.710848362 -0400 +@@ -330,18 +330,19 @@ + char *command; + { + static char bnm[FILESIZE]; +- register char *cp = bnm, ++ char nm[FILESIZE]; ++ char *cp = nm, + c; + + do { + c = *command++; + } while (jiswhite(c)); +- while (cp < &bnm[sizeof(bnm) - 1] && c != '\0' && !jiswhite(c)) { ++ while (cp < &nm[sizeof(nm) - 1] && c != '\0' && !jiswhite(c)) { + *cp++ = c; + c = *command++; + } + *cp = '\0'; +- strcpy(bnm, jbasename(bnm)); ++ strcpy(bnm, jbasename(nm)); + + return bnm; + } |