]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
append all VPs, not just the first one.
authorAlan T. DeKok <aland@freeradius.org>
Tue, 5 Jun 2018 16:55:22 +0000 (12:55 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Tue, 5 Jun 2018 16:55:22 +0000 (12:55 -0400)
it's rather surprising to see fr_cursor_append() set vp->next=NULL
which causes all kinds of issues with callers expecting something
else.

src/lib/util/pair.c

index 51a28a335c446b208ec263013ae851989e5a3b22..c39a5584428f4ee64cc54a8e0454c6b48067187c 100644 (file)
@@ -1652,7 +1652,7 @@ int fr_pair_list_afrom_file(TALLOC_CTX *ctx, VALUE_PAIR **out, FILE *fp, bool *p
        char buf[8192];
        FR_TOKEN last_token = T_EOL;
 
-       fr_cursor_t cursor;
+       fr_cursor_t cursor, to_append;
 
        VALUE_PAIR *vp = NULL;
        fr_cursor_init(&cursor, out);
@@ -1685,9 +1685,8 @@ int fr_pair_list_afrom_file(TALLOC_CTX *ctx, VALUE_PAIR **out, FILE *fp, bool *p
                        break;
                }
 
-               do {
-                       fr_cursor_append(&cursor, vp);
-               } while (vp->next && (vp = vp->next));
+               fr_cursor_init(&to_append, &vp);
+               fr_cursor_merge(&cursor, &to_append);
 
                buf[0] = '\0';
        }