Skip to content

Commit

Permalink
allow zero input
Browse files Browse the repository at this point in the history
  • Loading branch information
alandekok committed Oct 29, 2023
1 parent c574007 commit 4893a13
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/lib/util/pair_legacy.c
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,8 @@ fr_slen_t fr_pair_list_afrom_substr(fr_pair_parse_t const *root, fr_pair_parse_t
if (fr_dict_internal()) internal = fr_dict_root(fr_dict_internal());
if (internal == root->da) internal = NULL;

if (fr_sbuff_remaining(&our_in) == 0) return 0;

redo:
append = true;
raw = raw_octets = false;
Expand Down Expand Up @@ -513,7 +515,7 @@ fr_slen_t fr_pair_list_afrom_substr(fr_pair_parse_t const *root, fr_pair_parse_t
keep_going |= (len > 0);
}

keep_going &= (fr_sbuff_remaining(&our_in) > 0);
keep_going &= ((fr_sbuff_remaining(&our_in) > 0) || (fr_sbuff_extend(&our_in) > 0));

if (keep_going) goto redo;

Expand Down Expand Up @@ -582,7 +584,7 @@ int fr_pair_list_afrom_file(TALLOC_CTX *ctx, fr_dict_t const *dict, fr_pair_list
*
* foo = { bar = baz }
*/
if (fr_pair_list_afrom_substr(&root, &relative, &FR_SBUFF_IN(buf, strlen(buf))) <= 0) {
if (fr_pair_list_afrom_substr(&root, &relative, &FR_SBUFF_IN(buf, strlen(buf))) < 0) {
*pfiledone = false;
fr_pair_list_free(&tmp_list);
return -1;
Expand Down

0 comments on commit 4893a13

Please sign in to comment.