]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
increment 'i' when we use it, not at the end of the loop
authorAlan T. DeKok <aland@freeradius.org>
Fri, 28 Jul 2017 13:33:43 +0000 (09:33 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Fri, 28 Jul 2017 13:35:06 +0000 (09:35 -0400)
which means if we 'continue' after running a callback, it will
still increment 'i'

src/main/cf_parse.c

index 6e76665fe298356d2c254a0b166d2d1f167d26ad..13fc14b073c6db28e4866c85931574867d12fa80 100644 (file)
@@ -958,7 +958,7 @@ static int cf_subsection_parse(TALLOC_CTX *ctx, void *out, CONF_SECTION *cs, CON
                if (array) {
                        MEM(buff = talloc_zero_array(array, uint8_t, subcs_size));
                        if (rule->subcs_type) talloc_set_name_const(buff, rule->subcs_type);
-                       array[i] = buff;
+                       array[i++] = buff;
                }
 
                /*
@@ -983,8 +983,6 @@ static int cf_subsection_parse(TALLOC_CTX *ctx, void *out, CONF_SECTION *cs, CON
                        talloc_free(array);
                        return ret;
                }
-
-               i++;
        }
 
        if (out) *((uint8_t ***)out) = array;