From: Alan T. DeKok Date: Thu, 12 Oct 2023 17:57:09 +0000 (-0400) Subject: stop on empty buffer, too. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bec5cbf89da0144825ac6c4ec494c806eb7d4728;p=thirdparty%2Ffreeradius-server.git stop on empty buffer, too. The fr_pair_list_afrom_str() function should really be converted to sbuffs, but that isn't immediately trivial. It expect to see NUL-terminated C strings, and will misbehave if given bad data. Happily, all of the stgring value-boxes in the server are zero-terminated, so this isn't much of an issue. The same goes for input from unit_test_attribute. --- diff --git a/src/lib/util/pair_legacy.c b/src/lib/util/pair_legacy.c index 1410946fb5a..5acbbb87498 100644 --- a/src/lib/util/pair_legacy.c +++ b/src/lib/util/pair_legacy.c @@ -92,9 +92,9 @@ static ssize_t fr_pair_list_afrom_substr(TALLOC_CTX *ctx, fr_dict_attr_t const * if (internal == parent) internal = NULL; /* - * We allow an empty line. + * Zero data, or empty line. */ - if (buffer[0] == 0) { + if ((buffer == end) || (buffer[0] == 0)) { *token = T_EOL; return 0; }