From: James Jones Date: Mon, 6 Jan 2025 16:29:38 +0000 (-0600) Subject: Don't directly use buffer set in sbuff (CID #1634622) (#5460) X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=78d614512df04cd3d5d97c19504ec36cd9e1f2e6;p=thirdparty%2Ffreeradius-server.git Don't directly use buffer set in sbuff (CID #1634622) (#5460) Another case of an uninitialized local buffer used in an sbuff but referenced by name to print out. Coverity complains about it, not recognizing the the sbuff operation puts a value there. Referencing the start of the sbuff gets the same effect without complaint. --- diff --git a/src/bin/dhcpclient.c b/src/bin/dhcpclient.c index ccb9141d0c3..947494f504c 100644 --- a/src/bin/dhcpclient.c +++ b/src/bin/dhcpclient.c @@ -511,10 +511,13 @@ static void dhcp_packet_debug(fr_packet_t *packet, fr_pair_list_t *list, bool re for (vp = fr_pair_list_head(list); vp; vp = fr_pair_list_next(list, vp)) { + fr_sbuff_t out; + PAIR_VERIFY(vp); - (void) fr_pair_print(&FR_SBUFF_OUT(buffer, sizeof(buffer)), NULL, vp); - printf("\t%s\n", buffer); + out = FR_SBUFF_OUT(buffer, sizeof(buffer)); + (void) fr_pair_print(&out, NULL, vp); + printf("\t%s\n", fr_sbuff_start(&out)); } }