deleted file mode 100644
@@ -1,40 +0,0 @@
-From 3923fad2e4f6f3403c3d6f1176b113c1c1b91066 Mon Sep 17 00:00:00 2001
-From: Ravi Kant Sharma <rks1986@gmail.com>
-Date: Wed, 24 Jun 2026 11:30:40 +0200
-Subject: [PATCH] ssl_sock_ossl: fix OpenSSL 4.0 compatibility (#5036)
-
-Upstream-Status: Backport [https://github.com/pjsip/pjproject/commit/3923fad2e4f6]
-Signed-off-by: Jaipaul Cheernam <jaipaul.cheernam@est.tech>
----
- pjlib/src/pj/ssl_sock_ossl.c | 11 ++++-------
- 1 file changed, 4 insertions(+), 7 deletions(-)
-
-diff --git a/pjlib/src/pj/ssl_sock_ossl.c b/pjlib/src/pj/ssl_sock_ossl.c
-index 000aabad61..93fcf10f14 100644
---- a/pjlib/src/pj/ssl_sock_ossl.c
-+++ b/pjlib/src/pj/ssl_sock_ossl.c
-@@ -1645,10 +1645,7 @@ static pj_status_t init_ossl_ctx(pj_ssl_sock_t *ssock)
- if (PEM_read_bio_X509(new_bio, &x, NULL, NULL) == NULL)
- break;
-
-- if ((xn = X509_get_subject_name(x)) == NULL)
-- break;
--
-- if ((xn = X509_NAME_dup(xn)) == NULL )
-+ if ((xn = X509_NAME_dup(X509_get_subject_name(x))) == NULL )
- break;
-
- #if !USING_BORINGSSL
-@@ -2105,9 +2102,9 @@ static pj_bool_t parse_ossl_asn1_time(pj_time_val *tv, pj_bool_t *gmt,
- pj_parsed_time pt;
- int i;
-
-- utc = tm->type == V_ASN1_UTCTIME;
-- p = (char*)tm->data;
-- len = tm->length;
-+ utc = ASN1_STRING_type(tm) == V_ASN1_UTCTIME;
-+ p = (char*)M_ASN1_STRING_data(tm);
-+ len = M_ASN1_STRING_length(tm);
- end = p + len - 1;
-
- /* GMT */
deleted file mode 100644
@@ -1,42 +0,0 @@
-From b14ebbccf5c228ca298ad11ecae2cedde792edae Mon Sep 17 00:00:00 2001
-From: Nanang Izzuddin <nanang@teluu.com>
-Date: Wed, 17 Jun 2026 15:43:46 +0700
-Subject: [PATCH] Merge commit from fork
-
-When printing a generic array header (e.g. Allow, Require, Supported,
-Unsupported), the ": " delimiter following the header name was written
-with two unchecked stores. copy_advance() only guarantees that the
-header name itself fits, leaving as little as one byte before the end
-of the buffer. The colon then consumed the last byte and the trailing
-space was written one byte past the buffer end.
-
-Use copy_advance_char_check() for both delimiter bytes, matching the
-boundary-checked pattern already used by every other header printer in
-this file.
-
-Co-Authored-By Claude Code
-
-(cherry picked from commit d6a0e7f76611c3a6f530ee051e3e7a622bb1748c)
-
-CVE: CVE-2026-57160
-Upstream-Status: Backport [https://github.com/pjsip/pjproject/commit/d6a0e7f76611c3a6f530ee051e3e7a622bb1748c]
-Signed-off-by: Ankur Tyagi <ankur.tyagi85@gmail.com>
----
- pjsip/src/pjsip/sip_msg.c | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/pjsip/src/pjsip/sip_msg.c b/pjsip/src/pjsip/sip_msg.c
-index 06c8cce86..cdc99ff9e 100644
---- a/pjsip/src/pjsip/sip_msg.c
-+++ b/pjsip/src/pjsip/sip_msg.c
-@@ -964,8 +964,8 @@ static int pjsip_generic_array_hdr_print( pjsip_generic_array_hdr *hdr,
- &hdr->sname : &hdr->name;
-
- copy_advance(p, (*hname));
-- *p++ = ':';
-- *p++ = ' ';
-+ copy_advance_char_check(p, ':');
-+ copy_advance_char_check(p, ' ');
-
- if (hdr->count > 0) {
- unsigned i;
deleted file mode 100644
@@ -1,49 +0,0 @@
-From 656cd5ec76f0178448053a9ca44ce075cd7a27f9 Mon Sep 17 00:00:00 2001
-From: Nanang Izzuddin <nanang@teluu.com>
-Date: Wed, 17 Jun 2026 15:44:40 +0700
-Subject: [PATCH] Merge commit from fork
-
-Bound the number of Service-Route URIs stored in the fixed-size uri[]
-array by checking uri_cnt against PJ_ARRAY_SIZE(uri) before each write.
-Previously the count was only checked as the do/while continuation
-condition, which does not catch accumulation across multiple
-single-URI Service-Route headers, allowing a registrar response with
-more than PJSUA_ACC_MAX_PROXIES headers to write past the array.
-
-Co-Authored-By Claude Code
-
-(cherry picked from commit acc03b57cef7a7d31b8e1f5b9117437d7e87c591)
-
-CVE: CVE-2026-57161
-Upstream-Status: Backport [https://github.com/pjsip/pjproject/commit/acc03b57cef7a7d31b8e1f5b9117437d7e87c591]
-
-Signed-off-by: Ankur Tyagi <ankur.tyagi85@gmail.com>
----
- pjsip/src/pjsua-lib/pjsua_acc.c | 12 ++++++------
- 1 file changed, 6 insertions(+), 6 deletions(-)
-
-diff --git a/pjsip/src/pjsua-lib/pjsua_acc.c b/pjsip/src/pjsua-lib/pjsua_acc.c
-index f52518a2a..08c5efced 100644
---- a/pjsip/src/pjsua-lib/pjsua_acc.c
-+++ b/pjsip/src/pjsua-lib/pjsua_acc.c
-@@ -2278,14 +2278,14 @@ static void update_service_route(pjsua_acc *acc, pjsip_rx_data *rdata)
- return;
- }
-
-+ if (uri_cnt >= PJ_ARRAY_SIZE(uri)) {
-+ PJ_LOG(1,(THIS_FILE, "Error: too many Service-Route headers"));
-+ return;
-+ }
-+
- uri[uri_cnt++] = h->name_addr.uri;
- h = h->next;
-- } while (h != hr && uri_cnt != PJ_ARRAY_SIZE(uri));
--
-- if (h != hr) {
-- PJ_LOG(1,(THIS_FILE, "Error: too many Service-Route headers"));
-- return;
-- }
-+ } while (h != hr);
-
- /* Prepare to find next Service-Route header */
- hsr = hsr->next;
deleted file mode 100644
@@ -1,43 +0,0 @@
-From 1b64bfb240731bbf0fc194dec68bb9d9b08a20b2 Mon Sep 17 00:00:00 2001
-From: Nanang Izzuddin <nanang@teluu.com>
-Date: Wed, 17 Jun 2026 15:45:33 +0700
-Subject: [PATCH] Merge commit from fork
-
-sdes_encode_sdp() in transport_srtp_sdes.c wrote each parsed crypto tag
-into the fixed int tags[64] array without bounding the count, while the
-SDP parser allows up to PJMEDIA_MAX_SDP_ATTR (68) attributes. Reject
-the SDP with PJMEDIA_SRTP_ESDPINCRYPTO once the array capacity is
-reached, before the out-of-bounds write.
-
-Co-Authored-By Claude Code
-
-(cherry picked from commit a1b707c0c9b0506faf2a8a438b60f11ffd6a6fd9)
-
-CVE: CVE-2026-57162
-Upstream-Status: Backport [https://github.com/pjsip/pjproject/commit/a1b707c0c9b0506faf2a8a438b60f11ffd6a6fd9]
-
-Signed-off-by: Ankur Tyagi <ankur.tyagi85@gmail.com>
----
- pjmedia/src/pjmedia/transport_srtp_sdes.c | 9 +++++++++
- 1 file changed, 9 insertions(+)
-
-diff --git a/pjmedia/src/pjmedia/transport_srtp_sdes.c b/pjmedia/src/pjmedia/transport_srtp_sdes.c
-index 8f98292ba..45038e585 100644
---- a/pjmedia/src/pjmedia/transport_srtp_sdes.c
-+++ b/pjmedia/src/pjmedia/transport_srtp_sdes.c
-@@ -478,6 +478,15 @@ static pj_status_t sdes_encode_sdp( pjmedia_transport *tp,
-
- has_crypto_attr = PJ_TRUE;
-
-+ /* Bound writes to tags[] by its capacity. m_rem->attr_count
-+ * is capped by the SDP parser at PJMEDIA_MAX_SDP_ATTR, which
-+ * can exceed PJ_ARRAY_SIZE(tags); without this guard a remote
-+ * peer can overflow the stack array by sending more than
-+ * PJ_ARRAY_SIZE(tags) a=crypto attributes.
-+ */
-+ if (cr_attr_count >= PJ_ARRAY_SIZE(tags))
-+ return PJMEDIA_SRTP_ESDPINCRYPTO;
-+
- status = parse_attr_crypto(srtp->pool, m_rem->attr[i],
- &tmp_rx_crypto,
- &tags[cr_attr_count]);
deleted file mode 100644
@@ -1,52 +0,0 @@
-From 2276d5ff1fe185a6bb51ab741dd5d88e45dbaa47 Mon Sep 17 00:00:00 2001
-From: Nanang Izzuddin <nanang@teluu.com>
-Date: Wed, 17 Jun 2026 15:46:16 +0700
-Subject: [PATCH] Merge commit from fork
-
-The SAN-counting loop in tls_cert_get_info() (ssl_sock_gtls.c) called
-gnutls_x509_crt_get_subject_alt_name() with len still holding
-sizeof(buf) (512) from an earlier getter, while the output buffer is
-only 256 bytes, so an oversized SAN entry overflowed the stack. Set len
-to the true capacity (sizeof(out) - 1, matching the populate loop) on
-every iteration.
-
-Co-Authored-By Claude Code
-
-(cherry picked from commit c4a151af86fadd16d9480b2603eeb2abf4fb4f78)
-
-CVE: CVE-2026-57163
-Upstream-Status: Backport [https://github.com/pjsip/pjproject/commit/c4a151af86fadd16d9480b2603eeb2abf4fb4f78]
-
-Signed-off-by: Ankur Tyagi <ankur.tyagi85@gmail.com>
----
- pjlib/src/pj/ssl_sock_gtls.c | 12 +++++++++++-
- 1 file changed, 11 insertions(+), 1 deletion(-)
-
-diff --git a/pjlib/src/pj/ssl_sock_gtls.c b/pjlib/src/pj/ssl_sock_gtls.c
-index de3d5e99e..68ceea3f3 100644
---- a/pjlib/src/pj/ssl_sock_gtls.c
-+++ b/pjlib/src/pj/ssl_sock_gtls.c
-@@ -1018,12 +1018,22 @@ static void tls_cert_get_info(pj_pool_t *pool, pj_ssl_cert_info *ci,
- if (ci->version >= 3) {
- char out[256] = { 0 };
- /* Get the number of all alternate names so that we can allocate
-- * the correct number of bytes in subj_alt_name */
-+ * the correct number of bytes in subj_alt_name.
-+ *
-+ * Pass the true capacity of 'out' as the in/out size argument on
-+ * every iteration. 'len' otherwise still holds sizeof(buf) (512)
-+ * from an earlier getter, which would let GnuTLS copy an oversized
-+ * SubjectAltName entry past the end of the 256-byte 'out' buffer.
-+ * Use sizeof(out) - 1 to match the populate loop below, leaving
-+ * room for the NUL terminator GnuTLS appends to string names.
-+ */
-+ len = sizeof(out) - 1;
- while (gnutls_x509_crt_get_subject_alt_name(cert, seq, out, &len,
- NULL) !=
- GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE)
- {
- seq++;
-+ len = sizeof(out) - 1;
- }
-
- ci->subj_alt_name.entry = pj_pool_calloc(pool, seq,
deleted file mode 100644
@@ -1,66 +0,0 @@
-From 1160ff3c15cfa79f50d4bc6ce8066854f656066c Mon Sep 17 00:00:00 2001
-From: Nanang Izzuddin <nanang@teluu.com>
-Date: Wed, 17 Jun 2026 15:46:48 +0700
-Subject: [PATCH] Merge commit from fork
-
-http_on_data_read() in http_client.c grew the response buffer by a
-single doubling, which is insufficient when the server sends a body
-larger than twice the (attacker-supplied) Content-Length used for the
-initial allocation. Loop the doubling until the buffer fits, with a
-floor for the size==0 case to avoid an infinite loop.
-
-Co-Authored-By Claude Code
-
-(cherry picked from commit 8d5956afab2ede95ddb199078dc19a8ac0114f3d)
-
-CVE: CVE-2026-57164
-Upstream-Status: Backport [https://github.com/pjsip/pjproject/commit/8d5956afab2ede95ddb199078dc19a8ac0114f3d]
-
-Signed-off-by: Ankur Tyagi <ankur.tyagi85@gmail.com>
----
- pjlib-util/src/pjlib-util/http_client.c | 27 ++++++++++++++++++-------
- 1 file changed, 20 insertions(+), 7 deletions(-)
-
-diff --git a/pjlib-util/src/pjlib-util/http_client.c b/pjlib-util/src/pjlib-util/http_client.c
-index bd441acb9..d2771d240 100644
---- a/pjlib-util/src/pjlib-util/http_client.c
-+++ b/pjlib-util/src/pjlib-util/http_client.c
-@@ -432,18 +432,31 @@ static pj_bool_t http_on_data_read(pj_activesock_t *asock,
- hreq->response.size);
- }
-
-- /* If the size of data received exceeds its current size,
-- * grow the buffer by a factor of 2.
-+ /* If the size of data received exceeds its current size, grow the
-+ * buffer by a factor of 2 repeatedly, until it can actually hold
-+ * everything received so far. A single doubling is not sufficient
-+ * when the server delivers a body chunk larger than twice the
-+ * (possibly undersized) Content-Length used for the initial
-+ * allocation, which would otherwise overflow the buffer in the
-+ * pj_memcpy() below.
- */
-- if (hreq->tcp_state.current_read_size + size >
-- hreq->response.size)
-+ if (hreq->tcp_state.current_read_size + size >
-+ hreq->response.size)
- {
- void *olddata = hreq->response.data;
-+ pj_size_t new_size = hreq->response.size;
-
-- hreq->response.data = pj_pool_alloc(hreq->pool,
-- hreq->response.size << 1);
-+ /* Guard against size==0 (Content-Length: 0 with a body), which
-+ * would make the doubling loop below spin forever.
-+ */
-+ if (new_size == 0)
-+ new_size = INITIAL_DATA_BUF_SIZE;
-+ while (hreq->tcp_state.current_read_size + size > new_size)
-+ new_size <<= 1;
-+
-+ hreq->response.data = pj_pool_alloc(hreq->pool, new_size);
- pj_memcpy(hreq->response.data, olddata, hreq->response.size);
-- hreq->response.size <<= 1;
-+ hreq->response.size = new_size;
- }
-
- /* Append the response data. */
deleted file mode 100644
@@ -1,85 +0,0 @@
-From 5776ee452296d5277d71e2bb011709adec80a533 Mon Sep 17 00:00:00 2001
-From: Nanang Izzuddin <nanang@teluu.com>
-Date: Wed, 17 Jun 2026 15:47:29 +0700
-Subject: [PATCH] Merge commit from fork
-
-handle_up_down() in cli_telnet.c accumulated cur_pos + 2*rcmd->len +
-history->slen bytes into a fixed PJ_CLI_MAX_CMDBUF stack buffer with no
-bound check. Size the buffer for the worst case, clamp each term to
-PJ_CLI_MAX_CMDBUF, and replace the trailing unchecked pj_strcat with a
-bounded pj_memcpy.
-
-Co-Authored-By Claude Code
-
-(cherry picked from commit 628b71638465bacf66e767959e6acbab822eccd6)
-
-CVE: CVE-2026-57165
-Upstream-Status: Backport [https://github.com/pjsip/pjproject/commit/628b71638465bacf66e767959e6acbab822eccd6]
-
-Signed-off-by: Ankur Tyagi <ankur.tyagi85@gmail.com>
----
- pjlib-util/src/pjlib-util/cli_telnet.c | 33 ++++++++++++++++++++------
- 1 file changed, 26 insertions(+), 7 deletions(-)
-
-diff --git a/pjlib-util/src/pjlib-util/cli_telnet.c b/pjlib-util/src/pjlib-util/cli_telnet.c
-index 150727bb5..0a2954bd4 100644
---- a/pjlib-util/src/pjlib-util/cli_telnet.c
-+++ b/pjlib-util/src/pjlib-util/cli_telnet.c
-@@ -1141,7 +1141,14 @@ static pj_bool_t handle_up_down(cli_telnet_sess *sess, pj_bool_t is_up)
- history = get_prev_history(sess, is_up);
- if (history) {
- pj_str_t send_data;
-- char str[PJ_CLI_MAX_CMDBUF];
-+ /* The redraw sequence can accumulate up to
-+ * cur_pos + 2 * rcmd->len + history->slen
-+ * bytes, each term bounded by PJ_CLI_MAX_CMDBUF, so size the
-+ * local buffer for the worst case and clamp each term below.
-+ */
-+ char str[PJ_CLI_MAX_CMDBUF * 4];
-+ unsigned cur_pos, buf_len;
-+ pj_size_t hist_len;
- enum {
- MOVE_CURSOR_LEFT = 0x08,
- CLEAR_CHAR = 0x20
-@@ -1149,15 +1156,24 @@ static pj_bool_t handle_up_down(cli_telnet_sess *sess, pj_bool_t is_up)
- send_data.ptr = str;
- send_data.slen = 0;
-
-+ cur_pos = sess->rcmd->cur_pos;
-+ buf_len = sess->rcmd->len;
-+ hist_len = history->slen;
-+ if (cur_pos > PJ_CLI_MAX_CMDBUF)
-+ cur_pos = PJ_CLI_MAX_CMDBUF;
-+ if (buf_len > PJ_CLI_MAX_CMDBUF)
-+ buf_len = PJ_CLI_MAX_CMDBUF;
-+ if (hist_len > PJ_CLI_MAX_CMDBUF)
-+ hist_len = PJ_CLI_MAX_CMDBUF;
-+
- /* Move cursor position to the beginning of line */
-- if (sess->rcmd->cur_pos > 0) {
-- pj_memset(send_data.ptr, MOVE_CURSOR_LEFT, sess->rcmd->cur_pos);
-- send_data.slen = sess->rcmd->cur_pos;
-+ if (cur_pos > 0) {
-+ pj_memset(send_data.ptr, MOVE_CURSOR_LEFT, cur_pos);
-+ send_data.slen = cur_pos;
- }
-
-- if (sess->rcmd->len > (unsigned)history->slen) {
-+ if (buf_len > (unsigned)hist_len) {
- /* Clear the command currently shown*/
-- unsigned buf_len = sess->rcmd->len;
- pj_memset(&send_data.ptr[send_data.slen], CLEAR_CHAR, buf_len);
- send_data.slen += buf_len;
-
-@@ -1167,7 +1183,10 @@ static pj_bool_t handle_up_down(cli_telnet_sess *sess, pj_bool_t is_up)
- send_data.slen += buf_len;
- }
- /* Send data */
-- pj_strcat(&send_data, history);
-+ if (hist_len > 0) {
-+ pj_memcpy(&send_data.ptr[send_data.slen], history->ptr, hist_len);
-+ send_data.slen += hist_len;
-+ }
- telnet_sess_send(sess, &send_data);
- pj_ansi_strxcpy2((char*)sess->rcmd->rbuf, history,
- sizeof(sess->rcmd->rbuf));
deleted file mode 100644
@@ -1,228 +0,0 @@
-From d0b42b902bb6ca8a0a1393799db487642d3bf8ae Mon Sep 17 00:00:00 2001
-From: Nanang Izzuddin <nanang@teluu.com>
-Date: Wed, 17 Jun 2026 15:55:53 +0700
-Subject: [PATCH] Merge commit from fork
-
-* Fix pre-auth stack overflow formatting telnet CLI error indicator
-
-send_err_arg() in cli_telnet.c rendered the error caret into a fixed
-256-byte stack buffer using unchecked pj_strcat2; info->err_pos is
-bounded only by PJ_CLI_MAX_CMDBUF, so a long command line overflowed
-the buffer. Stream the spaces in bounded chunks via telnet_sess_send2,
-clamp the caret offset to PJ_CLI_MAX_CMDBUF, and send the message,
-prompt and echoed command separately, removing the stack buffer.
-
-Co-Authored-By Claude Code
-
-* Apply the same overflow fix to send_ambi_arg()
-
-Per review, send_ambi_arg() has the same issue as send_err_arg(): it
-renders an attacker-influenced number of caret spaces and appends the
-last command into a fixed 1028-byte stack buffer with unchecked
-pj_strcat2. info->err_pos and sess->rcmd->rbuf are bounded only by
-PJ_CLI_MAX_CMDBUF, so a long ambiguous command line could overflow it.
-
-Stream the caret offset in bounded chunks (clamped to PJ_CLI_MAX_CMDBUF)
-and stream the clamped last command separately, mirroring the
-send_err_arg() fix, instead of writing them into the fixed buffer. The
-shared SPACES constant is hoisted to file scope.
-
-Co-Authored-By Claude Code
-
-* Bound completion append in handle_tab()
-
-handle_tab() appended the matched command name into the fixed-size
-sess->rcmd->rbuf at offset len (the current command length) without
-checking that len + name length fits the buffer. len is bounded by the
-receive path, but the completion suffix is added on top, so a long
-completable command line could write past rbuf and its NUL terminator.
-
-Clamp the appended length to the space remaining in rbuf, leaving room
-for the terminator. Found while auditing the telnet CLI for the same
-fixed-buffer overflow pattern as send_err_arg()/send_ambi_arg().
-
-Co-Authored-By Claude Code
-
-(cherry picked from commit 4472a31d77a7506ff175dad5abef490f4e31bed1)
-
-CVE: CVE-2026-57166
-Upstream-Status: Backport [https://github.com/pjsip/pjproject/commit/4472a31d77a7506ff175dad5abef490f4e31bed1]
-
-Signed-off-by: Ankur Tyagi <ankur.tyagi85@gmail.com>
----
- pjlib-util/src/pjlib-util/cli_telnet.c | 116 ++++++++++++++++++-------
- 1 file changed, 84 insertions(+), 32 deletions(-)
-
-diff --git a/pjlib-util/src/pjlib-util/cli_telnet.c b/pjlib-util/src/pjlib-util/cli_telnet.c
-index 0a2954bd4..67898fdd8 100644
---- a/pjlib-util/src/pjlib-util/cli_telnet.c
-+++ b/pjlib-util/src/pjlib-util/cli_telnet.c
-@@ -680,6 +680,13 @@ static void send_prompt_str(cli_telnet_sess *sess)
- telnet_sess_send(sess, &send_data);
- }
-
-+/* Buffer of spaces, used to stream the caret offset in bounded chunks
-+ * instead of writing an attacker-influenced number of spaces into a
-+ * fixed-size stack buffer. Shared by send_err_arg() and send_ambi_arg().
-+ */
-+static const unsigned char SPACES[64] =
-+ " ";
-+
- /*
- * This method is used to send error message to client, including
- * the error position of the source command.
-@@ -690,32 +697,45 @@ static void send_err_arg(cli_telnet_sess *sess,
- pj_bool_t with_return,
- pj_bool_t with_last_cmd)
- {
-- pj_str_t send_data;
-- char data_str[256];
-- pj_size_t len;
-- unsigned i;
-+ pj_size_t len, remaining;
- cli_telnet_fe *fe = (cli_telnet_fe *)sess->base.fe;
-
-- send_data.ptr = data_str;
-- send_data.slen = 0;
--
- if (with_return)
-- pj_strcat2(&send_data, "\r\n");
-+ telnet_sess_send2(sess, (const unsigned char*)"\r\n", 2);
-
-+ /* Compute the caret offset. info->err_pos is derived from
-+ * attacker-supplied input (pj_cli_sess_parse) and is bounded only by
-+ * PJ_CLI_MAX_CMDBUF, so clamp it before emitting spaces. Otherwise a
-+ * ~500-byte command line would overflow the fixed-size stack buffer
-+ * this function previously used.
-+ */
- len = fe->cfg.prompt_str.slen + info->err_pos;
--
-- /* Set the error pointer mark */
-- for (i=0;i<len;++i) {
-- pj_strcat2(&send_data, " ");
-+ if (len > PJ_CLI_MAX_CMDBUF)
-+ len = PJ_CLI_MAX_CMDBUF;
-+
-+ remaining = len;
-+ while (remaining > 0) {
-+ pj_size_t chunk = (remaining > sizeof(SPACES)) ? sizeof(SPACES)
-+ : remaining;
-+ telnet_sess_send2(sess, SPACES, (int)chunk);
-+ remaining -= chunk;
- }
-- pj_strcat2(&send_data, "^");
-- pj_strcat2(&send_data, "\r\n");
-- pj_strcat(&send_data, msg);
-- pj_strcat(&send_data, &fe->cfg.prompt_str);
-- if (with_last_cmd)
-- pj_strcat2(&send_data, (char *)sess->rcmd->rbuf);
-
-- telnet_sess_send(sess, &send_data);
-+ telnet_sess_send2(sess, (const unsigned char*)"^\r\n", 3);
-+
-+ if (msg && msg->slen > 0)
-+ telnet_sess_send(sess, msg);
-+ if (fe->cfg.prompt_str.slen > 0)
-+ telnet_sess_send(sess, &fe->cfg.prompt_str);
-+ if (with_last_cmd) {
-+ pj_str_t last;
-+ last.ptr = (char *)sess->rcmd->rbuf;
-+ last.slen = (pj_ssize_t)pj_ansi_strlen((const char *)sess->rcmd->rbuf);
-+ if (last.slen > PJ_CLI_MAX_CMDBUF)
-+ last.slen = PJ_CLI_MAX_CMDBUF;
-+ if (last.slen > 0)
-+ telnet_sess_send(sess, &last);
-+ }
- }
-
- static void send_inv_arg(cli_telnet_sess *sess,
-@@ -765,7 +785,7 @@ static void send_ambi_arg(cli_telnet_sess *sess,
- pj_bool_t with_last_cmd)
- {
- unsigned i;
-- pj_size_t len;
-+ pj_size_t len, remaining;
- pj_str_t send_data;
- char data[1028];
- cli_telnet_fe *fe = (cli_telnet_fe *)sess->base.fe;
-@@ -779,14 +799,25 @@ static void send_ambi_arg(cli_telnet_sess *sess,
- send_data.slen = 0;
-
- if (with_return)
-- pj_strcat2(&send_data, "\r\n");
-+ telnet_sess_send2(sess, (const unsigned char*)"\r\n", 2);
-
-+ /* Compute and clamp the caret offset, then stream the spaces, like
-+ * send_err_arg(). info->err_pos is attacker-bounded only by
-+ * PJ_CLI_MAX_CMDBUF, so it must not drive writes into data[].
-+ */
- len = fe->cfg.prompt_str.slen + info->err_pos;
--
-- for (i=0;i<len;++i) {
-- pj_strcat2(&send_data, " ");
-+ if (len > PJ_CLI_MAX_CMDBUF)
-+ len = PJ_CLI_MAX_CMDBUF;
-+
-+ remaining = len;
-+ while (remaining > 0) {
-+ pj_size_t chunk = (remaining > sizeof(SPACES)) ? sizeof(SPACES)
-+ : remaining;
-+ telnet_sess_send2(sess, SPACES, (int)chunk);
-+ remaining -= chunk;
- }
-- pj_strcat2(&send_data, "^");
-+ telnet_sess_send2(sess, (const unsigned char*)"^", 1);
-+
- /* Get the max length of the command name */
- for (i=0;i<info->hint_cnt;++i) {
- if (hint[i].type.slen > 0) {
-@@ -874,10 +905,21 @@ static void send_ambi_arg(cli_telnet_sess *sess,
- }
- pj_strcat2(&send_data, "\r\n");
- pj_strcat(&send_data, &fe->cfg.prompt_str);
-- if (with_last_cmd)
-- pj_strcat2(&send_data, (char *)sess->rcmd->rbuf);
--
- telnet_sess_send(sess, &send_data);
-+
-+ /* Stream the last command separately with a clamp; sess->rcmd->rbuf
-+ * is attacker-bounded only by PJ_CLI_MAX_CMDBUF, so appending it into
-+ * data[] could overflow the fixed-size buffer.
-+ */
-+ if (with_last_cmd) {
-+ pj_str_t last;
-+ last.ptr = (char *)sess->rcmd->rbuf;
-+ last.slen = (pj_ssize_t)pj_ansi_strlen((const char *)sess->rcmd->rbuf);
-+ if (last.slen > PJ_CLI_MAX_CMDBUF)
-+ last.slen = PJ_CLI_MAX_CMDBUF;
-+ if (last.slen > 0)
-+ telnet_sess_send(sess, &last);
-+ }
- }
-
- /*
-@@ -1035,10 +1077,20 @@ static pj_bool_t handle_tab(cli_telnet_sess *sess)
- }
- send_comp_arg(sess, &info);
-
-- pj_memcpy(&sess->rcmd->rbuf[len], info.hint[0].name.ptr,
-- info.hint[0].name.slen);
--
-- len += (unsigned)info.hint[0].name.slen;
-+ /* Append the matched name into the fixed-size rbuf. len is
-+ * attacker-influenced (the typed command length), so clamp
-+ * the copy to leave room for the NUL terminator and avoid
-+ * overflowing rbuf.
-+ */
-+ if (len < sizeof(sess->rcmd->rbuf) - 1) {
-+ pj_size_t avail = sizeof(sess->rcmd->rbuf) - 1 - len;
-+ pj_size_t cplen = (pj_size_t)info.hint[0].name.slen;
-+ if (cplen > avail)
-+ cplen = avail;
-+ pj_memcpy(&sess->rcmd->rbuf[len],
-+ info.hint[0].name.ptr, cplen);
-+ len += (unsigned)cplen;
-+ }
- sess->rcmd->rbuf[len] = 0;
- }
- } else {
deleted file mode 100644
@@ -1,74 +0,0 @@
-From a927a964d462e9966864b7b2c432942b61038d6b Mon Sep 17 00:00:00 2001
-From: Nanang Izzuddin <nanang@teluu.com>
-Date: Mon, 13 Jul 2026 09:27:02 +0700
-Subject: [PATCH] Merge commit from fork
-
-The AVI player used a chunk length taken from the input file as the
-number of bytes to read into the video frame buffer, whose capacity is
-derived from the (also file-supplied) declared dimensions, without
-reconciling the two. A crafted file could therefore cause a write past
-the end of the buffer. The only guard was an assertion, which is a
-no-op in release builds.
-
-Clamp the read to the frame buffer capacity, skip any remaining chunk
-bytes so the file position stays aligned, and remove the reliance on
-the assertion for validating a file-supplied length.
-
-Ref: GHSA-6p2p-5wf8-h5hr
-(cherry picked from commit 7ecc6584969a923c4190b6912afbf5952b5a4b9f)
-
-CVE: CVE-2026-77396
-Upstream-Status: Backport [https://github.com/pjsip/pjproject/commit/7ecc6584969a923c4190b6912afbf5952b5a4b9f]
-Signed-off-by: Ankur Tyagi <ankur.tyagi85@gmail.com>
----
- pjmedia/src/pjmedia/avi_player.c | 34 +++++++++++++++++++++++++++++---
- 1 file changed, 31 insertions(+), 3 deletions(-)
-
-diff --git a/pjmedia/src/pjmedia/avi_player.c b/pjmedia/src/pjmedia/avi_player.c
-index dc87b8a41..8b4b94d16 100644
---- a/pjmedia/src/pjmedia/avi_player.c
-+++ b/pjmedia/src/pjmedia/avi_player.c
-@@ -1199,12 +1199,40 @@ static pj_status_t avi_get_frame(pjmedia_port *this_port,
- goto on_error2;
- fport->size_left -= size_to_read;
- } else {
-- pj_assert(frame->size >= ch.len);
-- status = file_read3(fport->fd, frame->buf, ch.len,
-+ pj_uint32_t read_len = ch.len;
-+
-+ /* Clamp the read to the frame buffer capacity. A crafted
-+ * file may declare a chunk larger than the buffer, whose
-+ * size is derived from the (also file-supplied) video
-+ * dimensions; never write past frame->buf (frame->size
-+ * bytes). Do not rely on pj_assert() here, as it is a no-op
-+ * in release builds.
-+ */
-+ if (read_len > frame->size) {
-+ PJ_LOG(3, (THIS_FILE,
-+ "AVI video chunk (%u) exceeds frame buffer "
-+ "(%u), truncating",
-+ (unsigned)ch.len, (unsigned)frame->size));
-+ read_len = (pj_uint32_t)frame->size;
-+ }
-+
-+ status = file_read3(fport->fd, frame->buf, read_len,
- 0, &size_read);
- if (status != PJ_SUCCESS)
- goto on_error2;
-- frame->size = ch.len;
-+
-+ /* Skip any remaining chunk bytes that did not fit, so the
-+ * file position stays aligned to the next chunk.
-+ */
-+ if (ch.len > read_len) {
-+ status = pj_file_setpos(fport->fd,
-+ (pj_off_t)ch.len - read_len,
-+ PJ_SEEK_CUR);
-+ if (status != PJ_SUCCESS)
-+ goto on_error2;
-+ }
-+
-+ frame->size = read_len;
- fport->size_left = 0;
- }
-
deleted file mode 100644
@@ -1,87 +0,0 @@
-From f00f023079d0f9a74477da47056bfce76374b2a7 Mon Sep 17 00:00:00 2001
-From: sauwming <ming@teluu.com>
-Date: Fri, 17 Jul 2026 16:46:33 +0800
-Subject: [PATCH] Merge commit from fork
-
-SubjectAltName entries from the OpenSSL and GnuTLS backends were copied
-with pj_strdup2(), which re-derives the length with strlen() and thus
-discards the length already returned by ASN1_STRING_to_UTF8() /
-gnutls_x509_crt_get_subject_alt_name(). A DNS SAN such as
-"victim.example\0.attacker" was therefore truncated to "victim.example".
-
-sip_transport_tls.c disables socket-layer verification and performs its
-own length-aware identity match against subj_alt_name, so the truncated
-prefix compared equal to the target host and a crafted certificate was
-accepted for the prefix hostname (server identity / hostname verification
-bypass; OpenSSL's own X509_check_host() rejects the same certificate).
-
-Copy the SAN using its explicit length via pj_strset()/pj_strdup_with_null()
-so embedded NULs are preserved and no longer truncated. The mbedTLS backend
-already copied with a length-bearing pj_str_t and was not affected.
-
-Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
-(cherry picked from commit 43d3bd77bb6833eab4c493503b8d564a754ddfdd)
-
-CVE: CVE-2026-84975
-Upstream-Status: Backport [https://github.com/pjsip/pjproject/commit/43d3bd77bb6833eab4c493503b8d564a754ddfdd]
-
-Signed-off-by: Ankur Tyagi <ankur.tyagi85@gmail.com>
----
- pjlib/src/pj/ssl_sock_gtls.c | 17 +++++++++++++++--
- pjlib/src/pj/ssl_sock_ossl.c | 14 +++++++++++---
- 2 files changed, 26 insertions(+), 5 deletions(-)
-
-diff --git a/pjlib/src/pj/ssl_sock_gtls.c b/pjlib/src/pj/ssl_sock_gtls.c
-index 68ceea3f3..ee977116b 100644
---- a/pjlib/src/pj/ssl_sock_gtls.c
-+++ b/pjlib/src/pj/ssl_sock_gtls.c
-@@ -1072,9 +1072,22 @@ static void tls_cert_get_info(pj_pool_t *pool, pj_ssl_cert_info *ci,
-
- if (len && type != PJ_SSL_CERT_NAME_UNKNOWN) {
- ci->subj_alt_name.entry[ci->subj_alt_name.cnt].type = type;
-- pj_strdup2(pool,
-+ if (type == PJ_SSL_CERT_NAME_IP) {
-+ pj_strdup2(pool,
- &ci->subj_alt_name.entry[ci->subj_alt_name.cnt].name,
-- type == PJ_SSL_CERT_NAME_IP ? buf : out);
-+ buf);
-+ } else {
-+ /* Preserve the reported length instead of using strlen(),
-+ * so a DNS SAN containing an embedded NUL is not truncated
-+ * at the NUL (which would allow a crafted cert to be
-+ * accepted for the prefix hostname; identity bypass).
-+ */
-+ pj_str_t tmp;
-+ pj_strset(&tmp, out, len);
-+ pj_strdup_with_null(pool,
-+ &ci->subj_alt_name.entry[ci->subj_alt_name.cnt].name,
-+ &tmp);
-+ }
- ci->subj_alt_name.cnt++;
- }
- }
-diff --git a/pjlib/src/pj/ssl_sock_ossl.c b/pjlib/src/pj/ssl_sock_ossl.c
-index 30b4eeaee..ceb6bca5b 100644
---- a/pjlib/src/pj/ssl_sock_ossl.c
-+++ b/pjlib/src/pj/ssl_sock_ossl.c
-@@ -2270,9 +2270,17 @@ static void get_cert_info(pj_pool_t *pool, pj_ssl_cert_info *ci, X509 *x,
- &ci->subj_alt_name.entry[ci->subj_alt_name.cnt].name,
- buf);
- } else {
-- pj_strdup2(pool,
-- &ci->subj_alt_name.entry[ci->subj_alt_name.cnt].name,
-- (char*)p);
-+ /* Preserve the explicit ASN.1 string length instead of
-+ * treating the data as a NUL-terminated C string. A DNS
-+ * SAN such as "host.example\0.attacker" would otherwise be
-+ * truncated at the embedded NUL, letting a crafted cert be
-+ * accepted for the prefix hostname (identity bypass).
-+ */
-+ pj_str_t tmp;
-+ pj_strset(&tmp, (char*)p, len);
-+ pj_strdup_with_null(pool,
-+ &ci->subj_alt_name.entry[ci->subj_alt_name.cnt].name,
-+ &tmp);
- OPENSSL_free(p);
- }
- ci->subj_alt_name.cnt++;
similarity index 90%
rename from meta-multimedia/recipes-multimedia/pjproject/pjproject_2.17.bb
rename to meta-multimedia/recipes-multimedia/pjproject/pjproject_2.18.bb
@@ -12,19 +12,9 @@ SECTION = "libs"
LICENSE = "GPL-2.0-or-later"
LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263"
-SRC_URI = "git://github.com/pjsip/pjproject.git;protocol=https;branch=master;tag=${PV} \
- file://0001-ssl_sock_ossl-fix-OpenSSL-4.0-compatibility.patch \
- file://CVE-2026-57160.patch \
- file://CVE-2026-57161.patch \
- file://CVE-2026-57162.patch \
- file://CVE-2026-57163.patch \
- file://CVE-2026-57164.patch \
- file://CVE-2026-57165.patch \
- file://CVE-2026-57166.patch \
- file://CVE-2026-77396.patch \
- file://CVE-2026-84975.patch \
- "
-SRCREV = "5a457451fa2712ba18e12b01738e8ff3af2b26fd"
+SRC_URI = "git://github.com/pjsip/pjproject.git;protocol=https;branch=master;tag=${PV}"
+SRCREV = "bd4a7189d83d94237b6f42f3b8274664dbe6ff94"
+UPSTREAM_CHECK_GITTAGREGEX = "^(?P<pver>\d+(\.\d+)+)$"
DEPENDS = "swig-native python3-setuptools-native"
- TLS: OCSP stapling, TLS 1.3 session resumption, Mbed TLS 4.x support and TURN TLS server certificate verification - Signaling-only B2BUA / third-party call control with app-supplied SDP - CMake as a full build system (Linux, Mac, iOS, Android, MSVC) - Fixes 49 security issues, including all CVEs previously patched here - Incompatible: DTLS-SRTP self-signed cert now uses an EC P-256 key (define PJMEDIA_SRTP_DTLS_USE_EC_KEY 0 for RSA); SSL cert serial_no is right-aligned with zero padding; pj_ssl_cert_load_direct() now takes its own references; VS2005/eVC4/VC6 projects removed. Recipe: drop the OpenSSL 4.0 compatibility patch and the nine CVE backports (CVE-2026-57160 .. 57166, CVE-2026-77396, CVE-2026-84975), all of which are contained in 2.18. Add UPSTREAM_CHECK_GITTAGREGEX so only release tags are seen. AI-Generated: Uses Claude Code Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com> --- ...k_ossl-fix-OpenSSL-4.0-compatibility.patch | 40 --- .../pjproject/pjproject/CVE-2026-57160.patch | 42 ---- .../pjproject/pjproject/CVE-2026-57161.patch | 49 ---- .../pjproject/pjproject/CVE-2026-57162.patch | 43 ---- .../pjproject/pjproject/CVE-2026-57163.patch | 52 ---- .../pjproject/pjproject/CVE-2026-57164.patch | 66 ----- .../pjproject/pjproject/CVE-2026-57165.patch | 85 ------- .../pjproject/pjproject/CVE-2026-57166.patch | 228 ------------------ .../pjproject/pjproject/CVE-2026-77396.patch | 74 ------ .../pjproject/pjproject/CVE-2026-84975.patch | 87 ------- .../{pjproject_2.17.bb => pjproject_2.18.bb} | 16 +- 11 files changed, 3 insertions(+), 779 deletions(-) delete mode 100644 meta-multimedia/recipes-multimedia/pjproject/pjproject/0001-ssl_sock_ossl-fix-OpenSSL-4.0-compatibility.patch delete mode 100644 meta-multimedia/recipes-multimedia/pjproject/pjproject/CVE-2026-57160.patch delete mode 100644 meta-multimedia/recipes-multimedia/pjproject/pjproject/CVE-2026-57161.patch delete mode 100644 meta-multimedia/recipes-multimedia/pjproject/pjproject/CVE-2026-57162.patch delete mode 100644 meta-multimedia/recipes-multimedia/pjproject/pjproject/CVE-2026-57163.patch delete mode 100644 meta-multimedia/recipes-multimedia/pjproject/pjproject/CVE-2026-57164.patch delete mode 100644 meta-multimedia/recipes-multimedia/pjproject/pjproject/CVE-2026-57165.patch delete mode 100644 meta-multimedia/recipes-multimedia/pjproject/pjproject/CVE-2026-57166.patch delete mode 100644 meta-multimedia/recipes-multimedia/pjproject/pjproject/CVE-2026-77396.patch delete mode 100644 meta-multimedia/recipes-multimedia/pjproject/pjproject/CVE-2026-84975.patch rename meta-multimedia/recipes-multimedia/pjproject/{pjproject_2.17.bb => pjproject_2.18.bb} (90%)