From d53e757af81f89a6f511c2ce1091b675d0f3f73e Mon Sep 17 00:00:00 2001 From: Donat Zenichev Date: Tue, 29 Jul 2025 15:55:10 +0200 Subject: [PATCH] MT#59962 AmB2BSession: acceptPendingInviteB2B() check body Check if body found before actually use it. Fixes: *** CID 583401: Null pointer dereferences (NULL_RETURNS) /core/AmB2BSession.cpp: 379 in AmB2BSession::acceptPendingInviteB2B(const AmSipRequest &)() 373 remote_port = remote_sdp_media.port; 374 } 375 } 376 377 if (remote_port > 0) { 378 ILOG_DLG(L_DBG, "Using remotely seen SDP port for faking this reply: '%d'\n", remote_port); >>> CID 583401: Null pointer dereferences (NULL_RETURNS) >>> Dereferencing a pointer that might be "nullptr" "sdp" when calling "addFakeSDPbasedOnPort". 379 addFakeSDPbasedOnPort(sdp, n_reply.body, remote_port); 380 } 381 else { 382 createFakeReply(sdp, n_reply.body); 383 } 384 Change-Id: I1aef23c68735b091ada8bca597cecea5987b46b0 --- core/AmB2BSession.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core/AmB2BSession.cpp b/core/AmB2BSession.cpp index e38573fb..83e0a5fc 100644 --- a/core/AmB2BSession.cpp +++ b/core/AmB2BSession.cpp @@ -365,6 +365,11 @@ void AmB2BSession::acceptPendingInvite(AmSipRequest *invite, const AmMimeBody *s void AmB2BSession::acceptPendingInviteB2B(const AmSipRequest& invite) { const AmMimeBody *sdp = invite.body.hasContentType(SIP_APPLICATION_SDP); + if (!sdp) { + ILOG_DLG(L_WARN, "No application/sdp content found to create fake 200OK.\n"); + return; + } + AmSipReply n_reply; /* local sdp, which was already learned before */