]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
stop on empty buffer, too.
authorAlan T. DeKok <aland@freeradius.org>
Thu, 12 Oct 2023 17:57:09 +0000 (13:57 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Thu, 12 Oct 2023 17:59:31 +0000 (13:59 -0400)
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.

src/lib/util/pair_legacy.c

index 1410946fb5a015fcd6ea18587edb5246bed27c9c..5acbbb87498fa6ecab6d6c14546d0eb6faf69e78 100644 (file)
@@ -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;
        }