string_to_idarray() will incorrectly exit with an error when the last element
of the passed in array gets filled. However it should only exit with an error
if there is more input. To fix this move the array bounds check.
Signed-off-by: Chandan B Rajenda <chandan@linux.vnet.ibm.com>
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
const char *end = NULL;
int id;
+ if (n >= arysz)
+ return -2;
if (!begin)
begin = p; /* begin of the column name */
if (*p == ',')
if (id == -1)
return -1;
ary[ n++ ] = id;
- if (n >= arysz)
- return -2;
begin = NULL;
if (end && !*end)
break;