From: Denys Vlasenko Date: Tue, 25 Aug 2015 19:47:33 +0000 (+0200) Subject: libbb: make is_suffixed_with() return pointer inside string, not key. X-Git-Tag: 1_24_0~54 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=68acc0f835360d439c65d349812b817b1ce5dc61;p=oweals%2Fbusybox.git libbb: make is_suffixed_with() return pointer inside string, not key. Signed-off-by: Denys Vlasenko --- 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) ssize_t len_diff = strlen(string) - key_len; if (len_diff >= 0) { - if (strcmp(string + len_diff, key) == 0) { - return (char*)key; + string += len_diff; + if (strcmp(string, key) == 0) { + return (char*)string; } }