diff options
author | jilles <jilles@FreeBSD.org> | 2010-12-26 13:25:47 +0000 |
---|---|---|
committer | jilles <jilles@FreeBSD.org> | 2010-12-26 13:25:47 +0000 |
commit | de73f385a5709ba788137d94801ead1014f1c5f0 (patch) | |
tree | 02dc00ec14f40f9ed9b75e0e6b62988d28b2ba9f /bin/sh/expand.c | |
parent | 290c1ef87ffbfdb591c830fd2874a87241390022 (diff) | |
download | FreeBSD-src-de73f385a5709ba788137d94801ead1014f1c5f0.zip FreeBSD-src-de73f385a5709ba788137d94801ead1014f1c5f0.tar.gz |
sh: Allow arbitrary large numbers in CHECKSTRSPACE.
Reduce "stack string" API somewhat and simplify code.
Add a check for integer overflow of the "stack string" length (probably
incomplete).
Diffstat (limited to 'bin/sh/expand.c')
-rw-r--r-- | bin/sh/expand.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/bin/sh/expand.c b/bin/sh/expand.c index a0b172e..b03cc3b 100644 --- a/bin/sh/expand.c +++ b/bin/sh/expand.c @@ -502,13 +502,14 @@ expbackq(union node *cmd, int quoted, int flag) if (lastc == '\n') { nnl++; } else { + CHECKSTRSPACE(nnl + 2, dest); while (nnl > 0) { nnl--; - STPUTC('\n', dest); + USTPUTC('\n', dest); } if (quotes && syntax[(int)lastc] == CCTL) - STPUTC(CTLESC, dest); - STPUTC(lastc, dest); + USTPUTC(CTLESC, dest); + USTPUTC(lastc, dest); } } } |