]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
fr_sbuff_is_terminal() returns true on !tt && EOF
authorAlan T. DeKok <aland@freeradius.org>
Thu, 17 Dec 2020 21:07:24 +0000 (16:07 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Fri, 18 Dec 2020 21:36:22 +0000 (16:36 -0500)
src/lib/util/sbuff.c

index f0a8e56b3a470191d971666eab4bee055949f3ba..915ed916717e219d940c9de03a92abf385412087 100644 (file)
@@ -1935,7 +1935,19 @@ bool fr_sbuff_is_terminal(fr_sbuff_t *in, fr_sbuff_term_t const *tt)
        uint8_t         idx[UINT8_MAX + 1];     /* Fast path index */
        size_t          needle_len = 1;
 
-       if (!tt) return false;
+       /*
+        *      No terminal, check for EOF.
+        */
+       if (!tt) {
+               fr_sbuff_extend_status_t status = FR_SBUFF_EXTENDABLE;
+
+               if ((fr_sbuff_extend_lowat(&status, in, 1) == 0) &&
+                   (status & FR_SBUFF_EXTEND_ERROR) == 0) {
+                       return true;
+               }
+               
+               return false;
+       }
 
        /*
         *      Initialise the fastpath index and