From: James Jones Date: Thu, 28 Sep 2023 16:29:07 +0000 (-0500) Subject: Placate coverity CID #1542424, #152423, #152422) (#5168) X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d6aede18528ee7f3f97f689ffe70955ff8a9de88;p=thirdparty%2Ffreeradius-server.git Placate coverity CID #1542424, #152423, #152422) (#5168) Currently, three functions mark requests as fake. That involves calling fr_pair_value_from_str() with the string being "127.0.0.1". Coverity notices that fr_pair_value_from_str() returns a value that isn't checked. * setup_fake_request() nominally returns an int, but it always returns zero, and no caller actuallly checks its return value. * The other functions, chbind_process() and eap_fast_eap_payload(), return fr_radius_packet_code_t, and it's not clear which fr_radius_packet_code_t makes sense in this case. So... we cast the fr_pair_value_from_str() calls to void. --- diff --git a/src/lib/eap/chbind.c b/src/lib/eap/chbind.c index 8a3d607cbaa..321b34c619f 100644 --- a/src/lib/eap/chbind.c +++ b/src/lib/eap/chbind.c @@ -187,7 +187,7 @@ fr_radius_packet_code_t chbind_process(request_t *request, CHBIND_REQ *chbind) /* Set-up the fake request */ fake = request_alloc_internal(request, &(request_init_args_t){ .parent = request }); MEM(fr_pair_prepend_by_da(fake->request_ctx, &vp, &fake->request_pairs, attr_freeradius_proxied_to) >= 0); - fr_pair_value_from_str(vp, "127.0.0.1", sizeof("127.0.0.1") - 1, NULL, false); + (void) fr_pair_value_from_str(vp, "127.0.0.1", sizeof("127.0.0.1") - 1, NULL, false); /* Add the username to the fake request */ if (chbind->username) { diff --git a/src/modules/rlm_eap/types/rlm_eap_fast/eap_fast.c b/src/modules/rlm_eap/types/rlm_eap_fast/eap_fast.c index 45eec88c9a5..1b3012333f3 100644 --- a/src/modules/rlm_eap/types/rlm_eap_fast/eap_fast.c +++ b/src/modules/rlm_eap/types/rlm_eap_fast/eap_fast.c @@ -601,7 +601,7 @@ static fr_radius_packet_code_t eap_fast_eap_payload(request_t *request, eap_sess * Tell the request that it's a fake one. */ MEM(fr_pair_prepend_by_da(fake->request_ctx, &vp, &fake->request_pairs, attr_freeradius_proxied_to) >= 0); - fr_pair_value_from_str(vp, "127.0.0.1", sizeof("127.0.0.1") - 1, NULL, false); + (void)fr_pair_value_from_str(vp, "127.0.0.1", sizeof("127.0.0.1") - 1, NULL, false); /* * If there's no User-Name in the stored data, look for diff --git a/src/modules/rlm_eap/types/rlm_eap_peap/peap.c b/src/modules/rlm_eap/types/rlm_eap_peap/peap.c index f13c57ba80e..5936d12e86c 100644 --- a/src/modules/rlm_eap/types/rlm_eap_peap/peap.c +++ b/src/modules/rlm_eap/types/rlm_eap_peap/peap.c @@ -608,7 +608,7 @@ static int CC_HINT(nonnull) setup_fake_request(request_t *request, request_t *fa * Tell the request that it's a fake one. */ MEM(fr_pair_prepend_by_da(fake->request_ctx, &vp, &fake->request_pairs, attr_freeradius_proxied_to) >= 0); - fr_pair_value_from_str(vp, "127.0.0.1", sizeof("127.0.0.1") - 1, NULL, false); + (void) fr_pair_value_from_str(vp, "127.0.0.1", sizeof("127.0.0.1") - 1, NULL, false); if (t->username) { vp = fr_pair_copy(fake->request_ctx, t->username);