From: Arran Cudbard-Bell Date: Thu, 31 May 2018 17:09:45 +0000 (+0600) Subject: vp has to be left pointing to the head of the list returned by fr_pair_list_afrom_str... X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=22ffa0f79ce480ec681e1f5dd26f376065e434b2;p=thirdparty%2Ffreeradius-server.git vp has to be left pointing to the head of the list returned by fr_pair_list_afrom_str, else the block termination check doesn't work --- diff --git a/src/lib/util/pair.c b/src/lib/util/pair.c index ad1db140ec3..457e76e25ca 100644 --- a/src/lib/util/pair.c +++ b/src/lib/util/pair.c @@ -1649,7 +1649,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, to_append; + fr_cursor_t cursor; VALUE_PAIR *vp = NULL; fr_cursor_init(&cursor, out); @@ -1657,7 +1657,7 @@ int fr_pair_list_afrom_file(TALLOC_CTX *ctx, VALUE_PAIR **out, FILE *fp, bool *p while (fgets(buf, sizeof(buf), fp) != NULL) { /* * If we get a '\n' by itself, we assume that's - * the end of that VP + * the end of that VP list. */ if (buf[0] == '\n') { if (vp) { @@ -1682,8 +1682,10 @@ int fr_pair_list_afrom_file(TALLOC_CTX *ctx, VALUE_PAIR **out, FILE *fp, bool *p break; } - fr_cursor_init(&to_append, &vp); - fr_cursor_merge(&cursor, &to_append); + do { + fr_cursor_append(&cursor, vp); + } while (vp->next && (vp = vp->next)); + buf[0] = '\0'; } *pfiledone = true;