From: Alejandro Colomar Date: Wed, 17 Jan 2024 01:50:42 +0000 (+0100) Subject: lib/list.c: is_on_list(): Move break condition to loop controlling expression X-Git-Tag: 4.15.1~14 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=46fd68c37e63e7c00b922c86c8e83aea4142510a;p=thirdparty%2Fshadow.git lib/list.c: is_on_list(): Move break condition to loop controlling expression This change executes `i++` one more time before breaking, so we need to update the `i+1` after the loop to just `i`. Signed-off-by: Alejandro Colomar --- diff --git a/lib/list.c b/lib/list.c index b88f5c5ab..28f530685 100644 --- a/lib/list.c +++ b/lib/list.c @@ -232,15 +232,13 @@ bool is_on_list (char *const *list, const char *member) * array of pointers. */ - for (cp = members, i = 0;; i++) { + for (cp = members, i = 0; cp != NULL; i++) { array[i] = cp; cp = strchr(cp, ','); if (NULL != cp) *cp++ = '\0'; - else - break; } - array[i+1] = NULL; + array[i] = NULL; /* * Return the new array of pointers