From cf4e4b97516a730e453f900a652d067d14909074 Mon Sep 17 00:00:00 2001 From: Siddharth Chandrasekaran Date: Mon, 29 Jul 2024 13:59:10 +0200 Subject: [PATCH] cp: Fix segfault in osdp_cp_teardown() osdp_cp_teardown() calls osdp_to_pd(ctx, 0) for all loop entries which causes a segfault. This issue was repported and fixed-by Marek Felskowski over email. Fixes: 2e07d66da7fd6b4a3dcccde6cd4ed64a617f4d93 Authored-by: Marek Felskowski Signed-off-by: Siddharth Chandrasekaran --- src/osdp_cp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/osdp_cp.c b/src/osdp_cp.c index a44c4b8..688a6e2 100644 --- a/src/osdp_cp.c +++ b/src/osdp_cp.c @@ -1464,7 +1464,7 @@ void osdp_cp_teardown(osdp_t *ctx) if (IS_ENABLED(CONFIG_OSDP_PACKET_TRACE) || IS_ENABLED(CONFIG_OSDP_DATA_TRACE)) { for (i = 0; i < NUM_PD(ctx); i++) { - pd = osdp_to_pd(ctx, 0); + pd = osdp_to_pd(ctx, i); osdp_packet_capture_finish(pd); } }