diff options
author | Jilles Tjoelker <jilles@FreeBSD.org> | 2010-12-26 13:25:47 +0000 |
---|---|---|
committer | Jilles Tjoelker <jilles@FreeBSD.org> | 2010-12-26 13:25:47 +0000 |
commit | d8f32e72878cc01f2bf93fb164756f14db521661 (patch) | |
tree | 02dc00ec14f40f9ed9b75e0e6b62988d28b2ba9f /bin/sh/exec.c | |
parent | 8ea0b3bb2fc36b4c87fc62ea82e4ef79a6df3c9c (diff) | |
download | src-d8f32e72878cc01f2bf93fb164756f14db521661.tar.gz src-d8f32e72878cc01f2bf93fb164756f14db521661.zip |
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).
Notes
Notes:
svn path=/head/; revision=216706
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 e104b63b9501..e916080cdd4e 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; |