commit:     4ca3664063ba0915ab4cce92fc0520d91e08c7d5
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Oct  6 14:37:19 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Oct  6 14:37:32 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4ca36640

net-misc/sipp: fix -Wformat-overflow

Closes: https://bugs.gentoo.org/940748
Signed-off-by: Sam James <sam <AT> gentoo.org>

 net-misc/sipp/files/sipp-3.7.3-overflow.patch | 84 +++++++++++++++++++++++++++
 net-misc/sipp/sipp-3.7.3-r1.ebuild            | 49 ++++++++++++++++
 2 files changed, 133 insertions(+)

diff --git a/net-misc/sipp/files/sipp-3.7.3-overflow.patch 
b/net-misc/sipp/files/sipp-3.7.3-overflow.patch
new file mode 100644
index 000000000000..87e9c468e576
--- /dev/null
+++ b/net-misc/sipp/files/sipp-3.7.3-overflow.patch
@@ -0,0 +1,84 @@
+https://bugs.gentoo.org/940748
+https://github.com/SIPp/sipp/commit/fdc0c97e1d8acbe4de0d89cf26dfe74bf9b413ed
+
+From fdc0c97e1d8acbe4de0d89cf26dfe74bf9b413ed Mon Sep 17 00:00:00 2001
+From: Orgad Shaneh <[email protected]>
+Date: Wed, 11 Sep 2024 20:55:06 +0300
+Subject: [PATCH] Fix 32-bit compilation
+
+--- a/src/call.cpp
++++ b/src/call.cpp
+@@ -1563,8 +1563,8 @@ char * call::get_last_header(const char * name)
+     if (name[len - 1] == ':') {
+         return get_header(last_recv_msg, name, false);
+     } else {
+-        char with_colon[MAX_HEADER_LEN];
+-        sprintf(with_colon, "%s:", name);
++        char with_colon[MAX_HEADER_LEN+2];
++        snprintf(with_colon, MAX_HEADER_LEN+2, "%s:", name);
+         return get_header(last_recv_msg, with_colon, false);
+     }
+ }
+@@ -1604,8 +1604,8 @@ char * call::get_last_request_uri()
+     }
+ 
+     last_request_uri[0] = '\0';
+-    if (tmp && (tmp_len > 0)) {
+-        strncpy(last_request_uri, tmp, tmp_len);
++    if (tmp_len > 0) {
++        memcpy(last_request_uri, tmp, tmp_len);
+     }
+     last_request_uri[tmp_len] = '\0';
+ 
+--- a/src/rtpstream.cpp
++++ b/src/rtpstream.cpp
+@@ -2702,7 +2702,7 @@ void rtpstream_audioecho_thread(void* param)
+                 pthread_mutex_lock(&debugremutexaudio);
+                 if (debugrefileaudio != nullptr)
+                 {
+-                    fprintf(debugrefileaudio, "DATA SUCCESSFULLY RECEIVED 
[AUDIO] nr = %ld...", nr);
++                    fprintf(debugrefileaudio, "DATA SUCCESSFULLY RECEIVED 
[AUDIO] nr = %d...", int(nr));
+                 }
+                 for (int i = 0; i < 12; i++)
+                 {
+@@ -2780,7 +2780,8 @@ void rtpstream_audioecho_thread(void* param)
+                     pthread_mutex_lock(&debugremutexaudio);
+                     if (debugrefileaudio != nullptr)
+                     {
+-                        fprintf(debugrefileaudio, "DATA SUCCESSFULLY SENT 
[AUDIO] seq_num = [%u] -- MISMATCHED RECV/SENT BYTE COUNT -- errno = %d nr = 
%ld ns = %ld\n", seq_num, errno, nr, ns);
++                        fprintf(debugrefileaudio, "DATA SUCCESSFULLY SENT 
[AUDIO] seq_num = [%u] -- MISMATCHED RECV/SENT BYTE COUNT -- errno = %d nr = %d 
ns = %d\n",
++                                seq_num, errno, int(nr), int(ns));
+                     }
+                     pthread_mutex_unlock(&debugremutexaudio);
+                 } else {
+@@ -2961,7 +2962,7 @@ void rtpstream_videoecho_thread(void* param)
+                 pthread_mutex_lock(&debugremutexvideo);
+                 if (debugrefilevideo != nullptr)
+                 {
+-                    fprintf(debugrefilevideo, "DATA SUCCESSFULLY RECEIVED 
[VIDEO] nr = %ld...", nr);
++                    fprintf(debugrefilevideo, "DATA SUCCESSFULLY RECEIVED 
[VIDEO] nr = %d...", int(nr));
+                 }
+                 for (int i = 0; i < 12; i++)
+                 {
+@@ -3038,7 +3039,8 @@ void rtpstream_videoecho_thread(void* param)
+                     pthread_mutex_lock(&debugremutexvideo);
+                     if (debugrefilevideo != nullptr)
+                     {
+-                        fprintf(debugrefilevideo, "DATA SUCCESSFULLY SENT 
[VIDEO] seq_num = [%u] -- MISMATCHED RECV/SENT BYTE COUNT -- errno = %d nr = 
%ld ns = %ld\n", seq_num, errno, nr, ns);
++                        fprintf(debugrefilevideo, "DATA SUCCESSFULLY SENT 
[VIDEO] seq_num = [%u] -- MISMATCHED RECV/SENT BYTE COUNT -- errno = %d nr = %d 
ns = %d\n",
++                                seq_num, errno, int(nr), int(ns));
+                     }
+                     pthread_mutex_unlock(&debugremutexvideo);
+                 } else {
+--- a/src/sip_parser.cpp
++++ b/src/sip_parser.cpp
+@@ -455,7 +455,7 @@ static const char* internal_find_header(const char* msg, 
const char* name, const
+         ptr = strchr(ptr, '\n');
+         if (!ptr || ptr[-1] != '\r' || (ptr[1] == '\r' && ptr[2] == '\n')) {
+             if (ptr && ptr[-1] != '\r') {
+-                WARNING("Missing CR during header scan at pos %ld", ptr - 
msg);
++                WARNING("Missing CR during header scan at pos %d", int(ptr - 
msg));
+                 /* continue? */
+             }
+             return nullptr;
+

diff --git a/net-misc/sipp/sipp-3.7.3-r1.ebuild 
b/net-misc/sipp/sipp-3.7.3-r1.ebuild
new file mode 100644
index 000000000000..fdfaa3ac31dd
--- /dev/null
+++ b/net-misc/sipp/sipp-3.7.3-r1.ebuild
@@ -0,0 +1,49 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit cmake
+
+DESCRIPTION="A free Open Source test tool / traffic generator for the SIP 
protocol"
+HOMEPAGE="https://github.com/SIPp/sipp";
+SRC_URI="https://github.com/SIPp/sipp/releases/download/v${PV}/${P}.tar.gz";
+
+LICENSE="GPL-2 ISC"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="gsl +pcap sctp +ssl"
+
+DEPEND="sys-libs/ncurses:=
+       gsl? ( sci-libs/gsl:= )
+       pcap? (
+               net-libs/libpcap
+               net-libs/libnet:1.1
+       )
+       sctp? ( net-misc/lksctp-tools )
+       ssl? ( dev-libs/openssl:= )
+"
+RDEPEND="${DEPEND}"
+
+PATCHES=(
+       "${FILESDIR}"/${P}-overflow.patch
+)
+
+src_configure() {
+       local mycmakeargs=(
+               -DUSE_GSL=$(usex gsl 1 0)
+               -DUSE_PCAP=$(usex pcap 1 0)
+               -DUSE_SCTP=$(usex sctp 1 0)
+               -DUSE_SSL=$(usex ssl 1 0)
+       )
+
+       cmake_src_configure
+}
+
+src_install() {
+       cmake_src_install
+
+       insinto /usr/share/${PN}
+       use pcap && doins pcap/*.pcap
+       dodoc CHANGES.md README.md
+}

Reply via email to