diff options
Diffstat (limited to 'bin')
-rw-r--r-- | bin/sh/parser.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/bin/sh/parser.c b/bin/sh/parser.c index e72a6f1..26c1362 100644 --- a/bin/sh/parser.c +++ b/bin/sh/parser.c @@ -1610,7 +1610,6 @@ endword: */ parsesub: { - char buf[10]; int subtype; int typeloc; int flags; @@ -1654,12 +1653,15 @@ varname: strncmp(out - length, "LINENO", length) == 0) { /* Replace the variable name with the * current line number. */ + STADJUST(-6, out); + CHECKSTRSPACE(11, out); linno = plinno; if (funclinno != 0) linno -= funclinno - 1; - snprintf(buf, sizeof(buf), "%d", linno); - STADJUST(-6, out); - STPUTS(buf, out); + length = snprintf(out, 11, "%d", linno); + if (length > 10) + length = 10; + out += length; flags |= VSLINENO; } } else if (is_digit(c)) { |