From fd830c41e3e090ad12cbfae16bcfd5c384b33435 Mon Sep 17 00:00:00 2001 From: Donat Zenichev Date: Tue, 28 Jul 2026 16:13:27 +0200 Subject: [PATCH] MT#65603 AmSipMsg: fix sip option parser Do not use the original iterator's position, when removing the first token from something like: `Supported: timer, path, replaces` Instead build the remaining option list by appending only those kept, trimmed tokens with commas between them. (P.S.: this is not related to the latest SST changes) Change-Id: I5a274072dbbc336494a0802ff7e80f0bf0b51813 --- core/AmSipMsg.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/core/AmSipMsg.cpp b/core/AmSipMsg.cpp index 1ac3932d..f1bd4c0f 100644 --- a/core/AmSipMsg.cpp +++ b/core/AmSipMsg.cpp @@ -195,13 +195,16 @@ void removeOptionTag(string& hdrs, const string& hdr_name, const string& tag) { bool found = false; for (std::vector::iterator it=options_v.begin(); it != options_v.end(); it++) { - if (trim(*it, " ")==tag) { + string option = trim(*it, " "); + if (option == tag) { found = true; continue; } - if (it != options_v.begin()) - o_hdr = ", "; - o_hdr+=*it; + if (option.empty()) + continue; + if (!o_hdr.empty()) + o_hdr += ", "; + o_hdr += option; } if (!found) return;