summaryrefslogtreecommitdiffstats
path: root/lib/strutils.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/strutils.c')
-rw-r--r--lib/strutils.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/strutils.c b/lib/strutils.c
index 75861607e..c40daf200 100644
--- a/lib/strutils.c
+++ b/lib/strutils.c
@@ -393,6 +393,8 @@ int string_to_idarray(const char *list, int ary[], size_t arysz,
const char *end = NULL;
int id;
+ if (n >= arysz)
+ return -2;
if (!begin)
begin = p; /* begin of the column name */
if (*p == ',')
@@ -408,8 +410,6 @@ int string_to_idarray(const char *list, int ary[], size_t arysz,
if (id == -1)
return -1;
ary[ n++ ] = id;
- if (n >= arysz)
- return -2;
begin = NULL;
if (end && !*end)
break;