From: Frank Lichtenheld Date: Mon, 6 Apr 2026 07:47:24 +0000 (+0200) Subject: test_packet_id: Add a check after malloc to ensure value is valid X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=cdb0fbde266a3c3013c1354a985e82c33db8dcdb;p=thirdparty%2Fopenvpn.git test_packet_id: Add a check after malloc to ensure value is valid cppcheck complains about a potential null pointer dereference in reliable_get_num_output_sequenced_available. That is mostly theoretical, but still add a check. Change-Id: I64da2328591ef2b9ee7502e574c878651cdf356a Signed-off-by: Frank Lichtenheld Acked-by: Gert Doering Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1621 Message-Id: <20260406074729.29903-1-gert@greenie.muc.de> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg36516.html Signed-off-by: Gert Doering --- diff --git a/tests/unit_tests/openvpn/test_packet_id.c b/tests/unit_tests/openvpn/test_packet_id.c index b7538bd5f..5dfd319ab 100644 --- a/tests/unit_tests/openvpn/test_packet_id.c +++ b/tests/unit_tests/openvpn/test_packet_id.c @@ -164,6 +164,7 @@ static void test_get_num_output_sequenced_available(void **state) { struct reliable *rel = malloc(sizeof(struct reliable)); + assert_non_null(rel); reliable_init(rel, 100, 50, 8, false); rel->array[5].active = true;