]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
don't modify slen on return
authorAlan T. DeKok <aland@freeradius.org>
Sun, 28 Jan 2024 16:49:56 +0000 (11:49 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Sun, 28 Jan 2024 16:49:56 +0000 (11:49 -0500)
src/protocols/dhcpv4/encode.c
src/protocols/dhcpv6/encode.c

index 06defb4769c5abacf531906eb877a480d90124ac..68470fc48fba68576e6286efc75b82cf3ebd77af 100644 (file)
@@ -774,7 +774,7 @@ ssize_t     fr_dhcpv4_encode_foreign(fr_dbuff_t *dbuff, fr_pair_list_t const *list)
         */
        while (fr_dcursor_current(&cursor) != NULL) {
                slen = fr_dhcpv4_encode_option(&work_dbuff, &cursor, &(fr_dhcpv4_ctx_t){ .root = fr_dict_root(dict_dhcpv4) });
-               if (slen <= 0) return slen - fr_dbuff_used(&work_dbuff);
+               if (slen < 0) return slen;
        }
 
        FR_PROTO_TRACE("Foreign option is %zu byte(s)", fr_dbuff_used(&work_dbuff));
index 2d4f48addb77d0fb0bf9613a8c1e4a0b65d9f14c..cf3cb67d3e9cc449e238f78697f623b3f32ff55a 100644 (file)
@@ -731,7 +731,7 @@ ssize_t     fr_dhcpv6_encode_foreign(fr_dbuff_t *dbuff, fr_pair_list_t const *list)
         */
        while (fr_dcursor_current(&cursor) != NULL) {
                slen = fr_dhcpv6_encode_option(&work_dbuff, &cursor, &(fr_dhcpv6_encode_ctx_t){ .root = fr_dict_root(dict_dhcpv6) });
-               if (slen <= 0) return slen - fr_dbuff_used(&work_dbuff);
+               if (slen < 0) return slen;
        }
 
        FR_PROTO_TRACE("Foreign option is %zu byte(s)", fr_dbuff_used(&work_dbuff));