summaryrefslogtreecommitdiff
path: root/libbb/compare_string_array.c
diff options
context:
space:
mode:
authorBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2007-03-30 14:43:27 +0000
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2007-03-30 14:43:27 +0000
commiteceecea568a483a3acec2d4c03228b39ae2d6501 (patch)
tree7faa56bbba59529be6f671026ae97bda84267917 /libbb/compare_string_array.c
parent52a9db6bb874c9ce7a8b7e935ba3ebbefdf3f7d4 (diff)
downloadbusybox-eceecea568a483a3acec2d4c03228b39ae2d6501.tar.gz
- fix bug where we did not reject invalid classes like '[[:alpha'
- debloat while at it: text data bss dec hex filename 1554 0 19 1573 625 tr.o.oorig 1357 0 16 1373 55d tr.o
Diffstat (limited to 'libbb/compare_string_array.c')
-rw-r--r--libbb/compare_string_array.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/libbb/compare_string_array.c b/libbb/compare_string_array.c
index d15578ca3..077a280a2 100644
--- a/libbb/compare_string_array.c
+++ b/libbb/compare_string_array.c
@@ -25,12 +25,11 @@ int index_in_substr_array(const char * const string_array[], const char *key)
{
int i;
int len = strlen(key);
- if (!len)
- return -1;
-
- for (i = 0; string_array[i] != 0; i++) {
- if (strncmp(string_array[i], key, len) == 0) {
- return i;
+ if (len) {
+ for (i = 0; string_array[i] != 0; i++) {
+ if (strncmp(string_array[i], key, len) == 0) {
+ return i;
+ }
}
}
return -1;