aboutsummaryrefslogtreecommitdiff
path: root/libbb/compare_string_array.c
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2020-07-09 13:10:58 +0100
committerRon Yorston <rmy@pobox.com>2020-07-09 13:10:58 +0100
commit9c0b2f7020d7c30b21a930ef54be632e092e533b (patch)
treeb2187c40bd2fd9f49f73599fb08e52cb7a596de0 /libbb/compare_string_array.c
parenta8c6e20e332a9e11a9d28cd6770eadb9c9d73cb7 (diff)
parentd21a63f9fca8eb16f79de9b72d4a3484dfaec1fc (diff)
downloadbusybox-w32-9c0b2f7020d7c30b21a930ef54be632e092e533b.tar.gz
busybox-w32-9c0b2f7020d7c30b21a930ef54be632e092e533b.tar.bz2
busybox-w32-9c0b2f7020d7c30b21a930ef54be632e092e533b.zip
Merge branch 'busybox' into merge
Diffstat (limited to 'libbb/compare_string_array.c')
-rw-r--r--libbb/compare_string_array.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/libbb/compare_string_array.c b/libbb/compare_string_array.c
index 856739c41..ede5a97e3 100644
--- a/libbb/compare_string_array.c
+++ b/libbb/compare_string_array.c
@@ -158,8 +158,11 @@ int FAST_FUNC index_in_substrings(const char *strings, const char *key)
158const char* FAST_FUNC nth_string(const char *strings, int n) 158const char* FAST_FUNC nth_string(const char *strings, int n)
159{ 159{
160 while (n) { 160 while (n) {
161 n--; 161 if (*strings++ == '\0') {
162 strings += strlen(strings) + 1; 162 if (*strings == '\0') /* reached end of strings */
163 break;
164 n--;
165 }
163 } 166 }
164 return strings; 167 return strings;
165} 168}