diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2015-08-25 21:47:33 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2015-08-25 21:47:33 +0200 |
commit | 68acc0f835360d439c65d349812b817b1ce5dc61 (patch) | |
tree | 28ab6ca95fe7078aed334c8675909d2c4d296318 | |
parent | 7448b513c84feb3fd06fc57b39f5ab450970c01e (diff) | |
download | busybox-w32-68acc0f835360d439c65d349812b817b1ce5dc61.tar.gz busybox-w32-68acc0f835360d439c65d349812b817b1ce5dc61.tar.bz2 busybox-w32-68acc0f835360d439c65d349812b817b1ce5dc61.zip |
libbb: make is_suffixed_with() return pointer inside string, not key.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | libbb/compare_string_array.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/libbb/compare_string_array.c b/libbb/compare_string_array.c index e0d8e421b..3dbd3eb1a 100644 --- a/libbb/compare_string_array.c +++ b/libbb/compare_string_array.c | |||
@@ -39,8 +39,9 @@ char* FAST_FUNC is_suffixed_with(const char *string, const char *key) | |||
39 | ssize_t len_diff = strlen(string) - key_len; | 39 | ssize_t len_diff = strlen(string) - key_len; |
40 | 40 | ||
41 | if (len_diff >= 0) { | 41 | if (len_diff >= 0) { |
42 | if (strcmp(string + len_diff, key) == 0) { | 42 | string += len_diff; |
43 | return (char*)key; | 43 | if (strcmp(string, key) == 0) { |
44 | return (char*)string; | ||
44 | } | 45 | } |
45 | } | 46 | } |
46 | 47 | ||