diff options
author | Ron Yorston <rmy@pobox.com> | 2020-08-23 11:02:12 +0100 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2020-08-23 11:45:56 +0100 |
commit | 9828af970e6b030823beb05dae56eed44cb65fb3 (patch) | |
tree | a90d0abe06bcafa070f06b4a4aedfa6953bd3087 | |
parent | 5dbbfe22dd28c3b3ecd5763cc8e60406136e87ce (diff) | |
download | busybox-w32-9828af970e6b030823beb05dae56eed44cb65fb3.tar.gz busybox-w32-9828af970e6b030823beb05dae56eed44cb65fb3.tar.bz2 busybox-w32-9828af970e6b030823beb05dae56eed44cb65fb3.zip |
libbb: reinstate NULL check in last_char_is()
Upstream commit 79a4032ee removed the test for a NULL argument to
last_char_is(). As reported in the upstream bug tracker this can
cause tar to segfault:
https://bugs.busybox.net/show_bug.cgi?id=13131
-rw-r--r-- | libbb/last_char_is.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libbb/last_char_is.c b/libbb/last_char_is.c index fba05f974..891739b5e 100644 --- a/libbb/last_char_is.c +++ b/libbb/last_char_is.c | |||
@@ -11,7 +11,7 @@ | |||
11 | /* Find out if the last character of a string matches the one given */ | 11 | /* Find out if the last character of a string matches the one given */ |
12 | char* FAST_FUNC last_char_is(const char *s, int c) | 12 | char* FAST_FUNC last_char_is(const char *s, int c) |
13 | { | 13 | { |
14 | if (!s[0]) | 14 | if (IF_PLATFORM_MINGW32(!s ||) !s[0]) |
15 | return NULL; | 15 | return NULL; |
16 | while (s[1]) | 16 | while (s[1]) |
17 | s++; | 17 | s++; |