diff options
Diffstat (limited to 'libbb/compare_string_array.c')
| -rw-r--r-- | libbb/compare_string_array.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/libbb/compare_string_array.c b/libbb/compare_string_array.c index 01a9df0e2..a06e57d3d 100644 --- a/libbb/compare_string_array.c +++ b/libbb/compare_string_array.c | |||
| @@ -117,8 +117,11 @@ int FAST_FUNC index_in_substrings(const char *strings, const char *key) | |||
| 117 | const char* FAST_FUNC nth_string(const char *strings, int n) | 117 | const char* FAST_FUNC nth_string(const char *strings, int n) |
| 118 | { | 118 | { |
| 119 | while (n) { | 119 | while (n) { |
| 120 | n--; | 120 | if (*strings++ == '\0') { |
| 121 | strings += strlen(strings) + 1; | 121 | if (*strings == '\0') /* reached end of strings */ |
| 122 | break; | ||
| 123 | n--; | ||
| 124 | } | ||
| 122 | } | 125 | } |
| 123 | return strings; | 126 | return strings; |
| 124 | } | 127 | } |
