]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Check returns (CID #1538387)
authorJames Jones <jejones3141@gmail.com>
Fri, 4 Aug 2023 18:56:57 +0000 (13:56 -0500)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Tue, 15 Aug 2023 23:22:34 +0000 (17:22 -0600)
Humans can figure out that
        FR_DBUFF_REMAINING_RETURN(&foo, bar);
implies that one can safely write bar bytes to the dbuff foo,
but coverity can't. There's another use, in fr_tacacs_encode(),
but the following operations using the dbuff are checked there.

src/protocols/dhcpv4/encode.c

index 48f2d30eef477fb6c1e5542ca2cb9528b8841a81..2410c34db2d04f782e336ddbd76f7e25b4af6e05 100644 (file)
@@ -582,10 +582,9 @@ static ssize_t encode_vsio_data(fr_dbuff_t *dbuff,
         *
         *      And leave room for data-len1
         */
-       fr_dbuff_in_bytes(&work_dbuff, (uint8_t) da->attr, 0x00);
-       /* coverity[check_return] */
-       fr_dbuff_in(&work_dbuff, dv->attr);
-       fr_dbuff_in_bytes(&work_dbuff, (uint8_t) 0x00);
+       FR_DBUFF_IN_BYTES_RETURN(&work_dbuff, (uint8_t) da->attr, 0x00);
+       FR_DBUFF_IN_RETURN(&work_dbuff, dv->attr);
+       FR_DBUFF_IN_BYTES_RETURN(&work_dbuff, (uint8_t) 0x00);
 
        /*
         *      https://tools.ietf.org/html/rfc3925#section-4