diff options
Diffstat (limited to '')
| -rw-r--r-- | shell/ash.c | 4 | ||||
| -rw-r--r-- | shell/math.c | 18 |
2 files changed, 17 insertions, 5 deletions
diff --git a/shell/ash.c b/shell/ash.c index 898b468cd..c25a6b3db 100644 --- a/shell/ash.c +++ b/shell/ash.c | |||
| @@ -250,6 +250,10 @@ | |||
| 250 | #include <sys/times.h> | 250 | #include <sys/times.h> |
| 251 | #include <sys/utsname.h> /* for setting $HOSTNAME */ | 251 | #include <sys/utsname.h> /* for setting $HOSTNAME */ |
| 252 | #include "busybox.h" /* for applet_names */ | 252 | #include "busybox.h" /* for applet_names */ |
| 253 | /* smaller code: avoid linking killpg() from libc */ | ||
| 254 | #undef killpg | ||
| 255 | #define killpg(pgrp,sig) kill(-(pgrp),sig) | ||
| 256 | |||
| 253 | #if ENABLE_FEATURE_SH_EMBEDDED_SCRIPTS | 257 | #if ENABLE_FEATURE_SH_EMBEDDED_SCRIPTS |
| 254 | # include "embedded_scripts.h" | 258 | # include "embedded_scripts.h" |
| 255 | #else | 259 | #else |
diff --git a/shell/math.c b/shell/math.c index e90a38f05..536f22ff0 100644 --- a/shell/math.c +++ b/shell/math.c | |||
| @@ -585,12 +585,21 @@ static arith_t parse_with_base(const char *nptr, char **endptr, unsigned base) | |||
| 585 | nptr++; | 585 | nptr++; |
| 586 | } | 586 | } |
| 587 | *endptr = (char*)nptr; | 587 | *endptr = (char*)nptr; |
| 588 | |||
| 588 | /* "64#" and "64#+1" used to be valid expressions, but bash 5.2.15 | 589 | /* "64#" and "64#+1" used to be valid expressions, but bash 5.2.15 |
| 589 | * no longer allow such, detect this: | 590 | * no longer allows such, detect this: |
| 590 | */ | 591 | */ |
| 591 | // NB: bash allows $((0x)), this is probably a bug... | 592 | if (nptr == start) { |
| 592 | if (nptr == start) | 593 | /* There weren't any digits */ |
| 593 | *endptr = NULL; /* there weren't any digits, bad */ | 594 | /* Excluding the case of "0x" |
| 595 | * (bash allows 0x: supports 0x$hexdigits when $hexdigits is empty) | ||
| 596 | */ | ||
| 597 | if (base != 16 /* why check 16? for base 10, start[-1] is undefined */ | ||
| 598 | || (start[-1] | 0x20) != 'x' | ||
| 599 | ) | ||
| 600 | *endptr = NULL; /* error indicator */ | ||
| 601 | } | ||
| 602 | |||
| 594 | return n; | 603 | return n; |
| 595 | } | 604 | } |
| 596 | 605 | ||
| @@ -611,7 +620,6 @@ static arith_t strto_arith_t(const char *nptr, char **endptr) | |||
| 611 | base = 16; | 620 | base = 16; |
| 612 | nptr += 2; | 621 | nptr += 2; |
| 613 | } | 622 | } |
| 614 | // NB: bash allows $((0x)), this is probably a bug... | ||
| 615 | return parse_with_base(nptr, endptr, base); | 623 | return parse_with_base(nptr, endptr, base); |
| 616 | } | 624 | } |
| 617 | 625 | ||
