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/exec.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/exec.c')
-rw-r--r-- | bin/sh/exec.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/bin/sh/exec.c b/bin/sh/exec.c index e104b63..e916080 100644 --- a/bin/sh/exec.c +++ b/bin/sh/exec.c @@ -190,9 +190,8 @@ padvance(const char **path, const char *name) for (p = start; *p && *p != ':' && *p != '%'; p++) ; /* nothing */ len = p - start + strlen(name) + 2; /* "2" is for '/' and '\0' */ - while (stackblocksize() < len) - growstackblock(); - q = stackblock(); + STARTSTACKSTR(q); + CHECKSTRSPACE(len, q); if (p != start) { memcpy(q, start, p - start); q += p - start; |