diff options
author | steve <steve@FreeBSD.org> | 1997-02-16 01:54:19 +0000 |
---|---|---|
committer | steve <steve@FreeBSD.org> | 1997-02-16 01:54:19 +0000 |
commit | 45d17b00931791e8f50c05fd3911e515bd5cb6ae (patch) | |
tree | af1620df30ae8499197013cc47a71eb2d41f7a3b /bin/sh | |
parent | 372a452bba052fcf5700e27eef599da622c0f038 (diff) | |
download | FreeBSD-src-45d17b00931791e8f50c05fd3911e515bd5cb6ae.zip FreeBSD-src-45d17b00931791e8f50c05fd3911e515bd5cb6ae.tar.gz |
Fix a expansion bug that caused the result of `echo $((1 << 30))`
to get truncated.
Submitted by: bde
Diffstat (limited to 'bin/sh')
-rw-r--r-- | bin/sh/expand.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/bin/sh/expand.c b/bin/sh/expand.c index 15fd182..0efed2e 100644 --- a/bin/sh/expand.c +++ b/bin/sh/expand.c @@ -335,7 +335,10 @@ expari(flag) * have to rescan starting from the beginning since CTLESC * characters have to be processed left to right. */ - CHECKSTRSPACE(8, expdest); +#if INT_MAX / 1000000000 >= 10 || INT_MIN / 1000000000 <= -10 +#error "integers with more than 10 digits are not supported" +#endif + CHECKSTRSPACE(12 - 2, expdest); USTPUTC('\0', expdest); start = stackblock(); p = expdest; @@ -350,7 +353,7 @@ expari(flag) if (quotes) rmescapes(p+1); result = arith(p+1); - fmtstr(p, 10, "%d", result); + fmtstr(p, 12, "%d", result); while (*p++) ; result = expdest - p + 1; |