Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package sipgrep for openSUSE:Factory checked in at 2026-08-24 12:10:00 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/sipgrep (Old) and /work/SRC/openSUSE:Factory/.sipgrep.new.1258 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "sipgrep" Mon Aug 24 12:10:00 2026 rev:3 rq:1373247 version:2.2.4 Changes: -------- --- /work/SRC/openSUSE:Factory/sipgrep/sipgrep.changes 2025-06-20 16:51:30.413465139 +0200 +++ /work/SRC/openSUSE:Factory/.sipgrep.new.1258/sipgrep.changes 2026-08-24 12:15:27.350179925 +0200 @@ -1,0 +2,22 @@ +Sun Aug 23 08:02:20 UTC 2026 - Andreas Stieger <[email protected]> + +- update to 2.2.4: + * Fix off-by-one in regex_and() so combined -f/-t/-c filters keep + the trailing ) + +------------------------------------------------------------------- +Sat Aug 22 18:57:54 UTC 2026 - Andreas Stieger <[email protected]> + +- update to 2.2.3: + * Accept Linux TUN/OpenVPN and Raw IP captures (DLT_RAW) + * -f/-t/-c are ANDed with the match expression + * -G prints dialog report only (no per-packet dump) +- includes changes from 2.2.2: + * Fix stack buffer overflow (CWE-787) in parse_message(): clamp + SIP reply reason phrase and Content-Length copies to 31 bytes + (boo#1276212) +- drop patches included upstream: + * sipgrep-2.2.0-inet_pton.patch + * sipgrep-gcc15.patch + +------------------------------------------------------------------- Old: ---- sipgrep-2.2.0-inet_pton.patch sipgrep-2.2.0.tar.gz sipgrep-gcc15.patch New: ---- sipgrep-2.2.4.tar.gz ----------(Old B)---------- Old:- drop patches included upstream: * sipgrep-2.2.0-inet_pton.patch * sipgrep-gcc15.patch Old: * sipgrep-2.2.0-inet_pton.patch * sipgrep-gcc15.patch ----------(Old E)---------- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ sipgrep.spec ++++++ --- /var/tmp/diff_new_pack.cJ3qYr/_old 2026-08-24 12:15:28.542222637 +0200 +++ /var/tmp/diff_new_pack.cJ3qYr/_new 2026-08-24 12:15:28.546222781 +0200 @@ -1,7 +1,7 @@ # # spec file for package sipgrep # -# Copyright (c) 2025 Andreas Stieger <[email protected]> +# Copyright (c) 2026 Andreas Stieger <[email protected]> # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -21,15 +21,12 @@ %bcond_without compression %bcond_without ssl Name: sipgrep -Version: 2.2.0 +Version: 2.2.4 Release: 0 Summary: Tool for displaying/troubleshooting SIP signaling on IP networks License: GPL-3.0-or-later URL: https://github.com/sipcapture/sipgrep Source: https://github.com/sipcapture/sipgrep/archive/refs/tags/%{version}.tar.gz#/%{name}-%{version}.tar.gz -Patch0: sipgrep-2.2.0-inet_pton.patch -# https://github.com/sipcapture/sipgrep/issues/47 -Patch1: sipgrep-gcc15.patch BuildRequires: autoconf BuildRequires: automake BuildRequires: libtool ++++++ sipgrep-2.2.0.tar.gz -> sipgrep-2.2.4.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sipgrep-2.2.0/README.md new/sipgrep-2.2.4/README.md --- old/sipgrep-2.2.0/README.md 2024-03-21 12:06:27.000000000 +0100 +++ new/sipgrep-2.2.4/README.md 2026-08-22 23:45:23.000000000 +0200 @@ -202,6 +202,6 @@ ## License -Copyright (c) 2014-2016 Alexandr Dubovikov +Copyright (c) 2014-2026 Alexandr Dubovikov sipgrep is released under GNU GPL v3. See [COPYING](COPYING) for details. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sipgrep-2.2.0/SECURITY.md new/sipgrep-2.2.4/SECURITY.md --- old/sipgrep-2.2.0/SECURITY.md 1970-01-01 01:00:00.000000000 +0100 +++ new/sipgrep-2.2.4/SECURITY.md 2026-08-22 23:45:23.000000000 +0200 @@ -0,0 +1,16 @@ +# Security Policy + +## Supported versions + +Security fixes are applied on the `master` branch and included in the next tagged release. + +## Reporting a vulnerability + +Please **do not** open a public GitHub issue for security reports. + +Use one of: + +1. [GitHub private vulnerability reporting](https://github.com/sipcapture/sipgrep/security/advisories/new) +2. Email: [[email protected]](mailto:[email protected]) + +Include the affected revision, a short description of the impact, and a way to reproduce the issue. We will acknowledge the report and coordinate a fix and disclosure window. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sipgrep-2.2.0/config.h new/sipgrep-2.2.4/config.h --- old/sipgrep-2.2.0/config.h 2024-03-21 12:06:27.000000000 +0100 +++ new/sipgrep-2.2.4/config.h 2026-08-22 23:45:23.000000000 +0200 @@ -121,7 +121,7 @@ #define PACKAGE_NAME "sipgrep" /* Define to the full name and version of this package. */ -#define PACKAGE_STRING "sipgrep 2.2.0" +#define PACKAGE_STRING "sipgrep 2.2.4" /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "sipgrep" @@ -130,7 +130,7 @@ #define PACKAGE_URL "http://www.sipcapture.org" /* Define to the version of this package. */ -#define PACKAGE_VERSION "2.2.0" +#define PACKAGE_VERSION "2.2.4" /* Define to 1 if you have the ANSI C header files. */ #define STDC_HEADERS 1 @@ -151,7 +151,7 @@ /* #undef USE_ZLIB */ /* Version number of package */ -#define VERSION "2.2.0" +#define VERSION "2.2.4" /* Define for Solaris 2.5.1 so the uint32_t typedef from <sys/synch.h>, <pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sipgrep-2.2.0/configure new/sipgrep-2.2.4/configure --- old/sipgrep-2.2.0/configure 2024-03-21 12:06:27.000000000 +0100 +++ new/sipgrep-2.2.4/configure 2026-08-22 23:45:23.000000000 +0200 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for sipgrep 2.2.0. +# Generated by GNU Autoconf 2.69 for sipgrep 2.2.4. # # Report bugs to <[email protected]>. # @@ -592,8 +592,8 @@ # Identity of this package. PACKAGE_NAME='sipgrep' PACKAGE_TARNAME='sipgrep' -PACKAGE_VERSION='2.2.0' -PACKAGE_STRING='sipgrep 2.2.0' +PACKAGE_VERSION='2.2.4' +PACKAGE_STRING='sipgrep 2.2.4' PACKAGE_BUGREPORT='[email protected]' PACKAGE_URL='http://www.sipcapture.org' @@ -1335,7 +1335,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures sipgrep 2.2.0 to adapt to many kinds of systems. +\`configure' configures sipgrep 2.2.4 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1405,7 +1405,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of sipgrep 2.2.0:";; + short | recursive ) echo "Configuration of sipgrep 2.2.4:";; esac cat <<\_ACEOF @@ -1513,7 +1513,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -sipgrep configure 2.2.0 +sipgrep configure 2.2.4 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2068,7 +2068,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by sipgrep $as_me 2.2.0, which was +It was created by sipgrep $as_me 2.2.4, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2885,7 +2885,7 @@ # Define the identity of the package. PACKAGE='sipgrep' - VERSION='2.2.0' + VERSION='2.2.4' cat >>confdefs.h <<_ACEOF @@ -14022,7 +14022,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by sipgrep $as_me 2.2.0, which was +This file was extended by sipgrep $as_me 2.2.4, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -14089,7 +14089,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -sipgrep config.status 2.2.0 +sipgrep config.status 2.2.4 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sipgrep-2.2.0/configure.ac new/sipgrep-2.2.4/configure.ac --- old/sipgrep-2.2.0/configure.ac 2024-03-21 12:06:27.000000000 +0100 +++ new/sipgrep-2.2.4/configure.ac 2026-08-22 23:45:23.000000000 +0200 @@ -1,5 +1,5 @@ AC_PREREQ(2.61) -AC_INIT(sipgrep,2.2.1,[email protected],,[http://www.sipcapture.org]) +AC_INIT(sipgrep,2.2.4,[email protected],,[http://www.sipcapture.org]) AC_COPYRIGHT("SIP Capture Solution") AC_CONFIG_MACRO_DIR([m4]) AM_INIT_AUTOMAKE(foreign tar-ustar) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sipgrep-2.2.0/pkg/deb/debian/changelog new/sipgrep-2.2.4/pkg/deb/debian/changelog --- old/sipgrep-2.2.0/pkg/deb/debian/changelog 2024-03-21 12:06:27.000000000 +0100 +++ new/sipgrep-2.2.4/pkg/deb/debian/changelog 2026-08-22 23:45:23.000000000 +0200 @@ -1,3 +1,21 @@ +sipgrep (2.2.4) UNRELEASED; urgency=medium + + * Fix off-by-one in regex_and() so combined -f/-t/-c filters keep the trailing parenthesis. + + -- Alexandr Dubovikov <[email protected]> Sat, 22 Aug 2026 23:44:52 +0200 + +sipgrep (2.2.3) UNRELEASED; urgency=medium + + * DLT_RAW / tun capture, FreeBSD netinet headers, AND header filters with match expression, -G report-only. + + -- Alexandr Dubovikov <[email protected]> Thu, 20 Aug 2026 21:45:00 +0200 + +sipgrep (2.2.2) UNRELEASED; urgency=medium + + * Clamp SIP reason phrase and Content-Length copies to prevent stack overflow. + + -- Alexandr Dubovikov <[email protected]> Thu, 20 Aug 2026 21:25:00 +0200 + sipgrep (2.2.0~dev) UNRELEASED; urgency=medium * Devel version diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sipgrep-2.2.0/pkg/deb/debian/copyright new/sipgrep-2.2.4/pkg/deb/debian/copyright --- old/sipgrep-2.2.0/pkg/deb/debian/copyright 2024-03-21 12:06:27.000000000 +0100 +++ new/sipgrep-2.2.4/pkg/deb/debian/copyright 2026-08-22 23:45:23.000000000 +0200 @@ -8,8 +8,8 @@ Copyright (c) 2006 Jordan Ritter <[email protected]> Copyright (c) 2007 Jan Andres <[email protected]> Copyright (c) 2003-2014, Troy D. Hanson http://troydhanson.github.com/uthash/ - Copyright (c) 2014, 2015 Alexandr Dubovikov <[email protected]> - Copyright (c) 2014, 2015 Lorenzo Mangani <[email protected]> + Copyright (c) 2014-2026 Alexandr Dubovikov <[email protected]> + Copyright (c) 2014-2026 Lorenzo Mangani <[email protected]> License: GPL-3.0+ On Debian systems, the full text of the GNU General Public License version 3 can be found in the file `/usr/share/common-licenses/GPL-3'. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sipgrep-2.2.0/sipgrep.8 new/sipgrep-2.2.4/sipgrep.8 --- old/sipgrep-2.2.0/sipgrep.8 2024-03-21 12:06:27.000000000 +0100 +++ new/sipgrep-2.2.4/sipgrep.8 2026-08-22 23:45:23.000000000 +0200 @@ -2,8 +2,8 @@ .\" .\" All content, except portions of the bpf filter explanation, are: .\" -.\" Copyright (c) 2014 Alexandr Dubovikov <[email protected]> -.\" Copyright (c) 2014 Sipcapture.org <[email protected]> +.\" Copyright (c) 2014-2026 Alexandr Dubovikov <[email protected]> +.\" Copyright (c) 2014-2026 Sipcapture.org <[email protected]> .\" .\" Please refer to the COPYING file for more information. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sipgrep-2.2.0/src/include/core_hep.h new/sipgrep-2.2.4/src/include/core_hep.h --- old/sipgrep-2.2.0/src/include/core_hep.h 2024-03-21 12:06:27.000000000 +0100 +++ new/sipgrep-2.2.4/src/include/core_hep.h 2026-08-22 23:45:23.000000000 +0200 @@ -4,7 +4,7 @@ * sipgrep - Monitoring tools * * Author: Alexandr Dubovikov <[email protected]> - * (C) Homer Project 2014 (http://www.sipcapture.org) + * (C) Homer Project 2014-2026 (http://www.sipcapture.org) * * Sipgrep is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sipgrep-2.2.0/src/include/log.h new/sipgrep-2.2.4/src/include/log.h --- old/sipgrep-2.2.0/src/include/log.h 2024-03-21 12:06:27.000000000 +0100 +++ new/sipgrep-2.2.4/src/include/log.h 2026-08-22 23:45:23.000000000 +0200 @@ -3,7 +3,7 @@ * sipgrep - Monitoring tools * * Author: Alexandr Dubovikov <[email protected]> - * (C) Homer Project 2014-16 (http://www.sipcapture.org) + * (C) Homer Project 2014-2026 (http://www.sipcapture.org) * * sipgrep is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sipgrep-2.2.0/src/include/sipgrep.h new/sipgrep-2.2.4/src/include/sipgrep.h --- old/sipgrep-2.2.0/src/include/sipgrep.h 2024-03-21 12:06:27.000000000 +0100 +++ new/sipgrep-2.2.4/src/include/sipgrep.h 2026-08-22 23:45:23.000000000 +0200 @@ -4,7 +4,7 @@ /* * sipgrep.h, v 2.0 2014/03/18 * - * Copyright (c) 2013-14 Alexandr Dubovikov <[email protected]> + * Copyright (c) 2013-2026 Alexandr Dubovikov <[email protected]> * */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sipgrep-2.2.0/src/include/sipparse.h new/sipgrep-2.2.4/src/include/sipparse.h --- old/sipgrep-2.2.0/src/include/sipparse.h 2024-03-21 12:06:27.000000000 +0100 +++ new/sipgrep-2.2.4/src/include/sipparse.h 2026-08-22 23:45:23.000000000 +0200 @@ -3,7 +3,7 @@ * sipgrep - Monitoring tools * * Author: Alexandr Dubovikov <[email protected]> - * (C) Homer Project 2014 (http://www.sipcapture.org) + * (C) Homer Project 2014-2026 (http://www.sipcapture.org) * * Sipgrep is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sipgrep-2.2.0/src/include/transport_hep.h new/sipgrep-2.2.4/src/include/transport_hep.h --- old/sipgrep-2.2.0/src/include/transport_hep.h 2024-03-21 12:06:27.000000000 +0100 +++ new/sipgrep-2.2.4/src/include/transport_hep.h 2026-08-22 23:45:23.000000000 +0200 @@ -4,7 +4,7 @@ * sipgrep - Monitoring tools * * Author: Alexandr Dubovikov <[email protected]> - * (C) Homer Project 2014 (http://www.sipcapture.org) + * (C) Homer Project 2014-2026 (http://www.sipcapture.org) * * Sipgrep is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sipgrep-2.2.0/src/include/user_interface.h new/sipgrep-2.2.4/src/include/user_interface.h --- old/sipgrep-2.2.0/src/include/user_interface.h 2024-03-21 12:06:27.000000000 +0100 +++ new/sipgrep-2.2.4/src/include/user_interface.h 2026-08-22 23:45:23.000000000 +0200 @@ -4,7 +4,7 @@ * sipgrep - Monitoring tools * * Author: Alexandr Dubovikov <[email protected]> - * (C) Homer Project 2014 (http://www.sipcapture.org) + * (C) Homer Project 2014-2026 (http://www.sipcapture.org) * * Sipgrep is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sipgrep-2.2.0/src/ipreasm.c new/sipgrep-2.2.4/src/ipreasm.c --- old/sipgrep-2.2.0/src/ipreasm.c 2024-03-21 12:06:27.000000000 +0100 +++ new/sipgrep-2.2.4/src/ipreasm.c 2026-08-22 23:45:23.000000000 +0200 @@ -14,6 +14,12 @@ #include "config.h" #endif /* HAVE_CONFIG_H */ +#include <sys/types.h> +#include <sys/socket.h> +#include <netinet/in.h> +#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__APPLE__) || defined(__sun) || defined(OS_FREEBSD) || defined(OS_SOLARIS) || defined(OS_DARWIN) || defined(OS_NETBSD) +#include <netinet/in_systm.h> +#endif #include <netinet/ip.h> #include <netinet/udp.h> #if USE_IPv6 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sipgrep-2.2.0/src/log.c new/sipgrep-2.2.4/src/log.c --- old/sipgrep-2.2.0/src/log.c 2024-03-21 12:06:27.000000000 +0100 +++ new/sipgrep-2.2.4/src/log.c 2026-08-22 23:45:23.000000000 +0200 @@ -3,7 +3,7 @@ * sipgrep - Monitoring tools * * Author: Alexandr Dubovikov <[email protected]> - * (C) Homer Project 2014-16 (http://www.sipcapture.org) + * (C) Homer Project 2014-2026 (http://www.sipcapture.org) * * sipgrep is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sipgrep-2.2.0/src/sipgrep.c new/sipgrep-2.2.4/src/sipgrep.c --- old/sipgrep-2.2.0/src/sipgrep.c 2024-03-21 12:06:27.000000000 +0100 +++ new/sipgrep-2.2.4/src/sipgrep.c 2026-08-22 23:45:23.000000000 +0200 @@ -2,7 +2,7 @@ * sipgrep - Monitoring tools * * Author: Alexandr Dubovikov <[email protected]> - * (C) Homer Project 2014-24 (http://www.sipcapture.org) + * (C) Homer Project 2014-2026 (http://www.sipcapture.org) * * Sipgrep is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -163,7 +163,7 @@ PCRE2_SPTR match_data = NULL; char *bin_data = NULL; uint16_t match_len = 0; -int8_t (*match_func) () = &blank_match_func; +int8_t (*match_func) (unsigned char *, uint32_t) = &blank_match_func; int8_t dump_single = 0; void (*dump_func) (unsigned char *, uint32_t) = &dump_byline; @@ -189,7 +189,7 @@ struct timeval prev_ts = { 0, 0 }, prev_delay_ts = { 0, 0}; -void (*print_time) () = NULL, (*dump_delay) () = dump_delay_proc_init; +void (*print_time) (struct pcap_pkthdr *) = NULL, (*dump_delay) (struct pcap_pkthdr *) = dump_delay_proc_init; uint32_t ws_row, ws_col = 80, ws_col_forced = 0; @@ -226,7 +226,34 @@ char *friendly_scanner_uac = "friendly-scanner"; char *friendly_scanner_range; +static char * +regex_and (const char *a, const char *b) +{ + size_t n; + char *out; + if (!a && !b) + return NULL; + if (!a) { + out = malloc (strlen (b) + 1); + if (out) + strcpy (out, b); + return out; + } + if (!b) { + out = malloc (strlen (a) + 1); + if (out) + strcpy (out, a); + return out; + } + + n = strlen (a) + strlen (b) + 8 + 1; + out = malloc (n); + if (!out) + return NULL; + snprintf (out, n, "(?=%s)(?=%s)", a, b); + return out; +} int main (int argc, char **argv) @@ -294,6 +321,8 @@ break; case 'G': print_report = 1; + if (quiet < 3) + quiet = 3; break; case 'O': dump_file = optarg; @@ -520,25 +549,45 @@ } - /* custom filter */ - - if (sip_to_filter && sip_from_filter) { - - custom_filter = malloc (strlen (sip_to_filter) + strlen (sip_from_filter) + strlen (SIP_FROM_TO_MATCH)); - sprintf (custom_filter, SIP_FROM_TO_MATCH, sip_from_filter, sip_to_filter); - match_data = custom_filter; - } - else if (sip_from_filter) { + /* Header filters (-f/-t/-c) AND the match expression, not replace it. */ + { + char *header_filter = NULL; - custom_filter = malloc (strlen (sip_from_filter) + strlen (SIP_FROM_MATCH)); - sprintf (custom_filter, SIP_FROM_MATCH, sip_from_filter); - match_data = custom_filter; - } - else if (sip_to_filter) { + if (sip_to_filter && sip_from_filter) { + header_filter = malloc (strlen (sip_to_filter) + strlen (sip_from_filter) + strlen (SIP_FROM_TO_MATCH) + 1); + sprintf (header_filter, SIP_FROM_TO_MATCH, sip_from_filter, sip_to_filter); + } + else if (sip_from_filter) { + header_filter = malloc (strlen (sip_from_filter) + strlen (SIP_FROM_MATCH) + 1); + sprintf (header_filter, SIP_FROM_MATCH, sip_from_filter); + } + else if (sip_to_filter) { + header_filter = malloc (strlen (sip_to_filter) + strlen (SIP_TO_MATCH) + 1); + sprintf (header_filter, SIP_TO_MATCH, sip_to_filter); + } + + if (sip_contact_filter) { + char *cm = malloc (strlen (sip_contact_filter) + strlen (SIP_CONTACT_MATCH) + 1); + sprintf (cm, SIP_CONTACT_MATCH, sip_contact_filter); + if (header_filter) { + char *both = regex_and (header_filter, cm); + free (header_filter); + free (cm); + header_filter = both; + } + else + header_filter = cm; + } - custom_filter = malloc (strlen (sip_to_filter) + strlen (SIP_TO_MATCH)); - sprintf (custom_filter, SIP_TO_MATCH, sip_to_filter); - match_data = custom_filter; + if (header_filter && match_data) { + custom_filter = regex_and (match_data, header_filter); + free (header_filter); + match_data = custom_filter; + } + else if (header_filter) { + custom_filter = header_filter; + match_data = custom_filter; + } } @@ -617,29 +666,41 @@ link_offset = PPPHDR_SIZE; break; -#if HAVE_DLT_LOOP +#ifdef DLT_LOOP case DLT_LOOP: #endif case DLT_NULL: link_offset = LOOPHDR_SIZE; break; -#if HAVE_DLT_RAW +#ifdef DLT_RAW case DLT_RAW: link_offset = RAWHDR_SIZE; break; #endif +#ifdef DLT_IPV4 + case DLT_IPV4: + link_offset = RAWHDR_SIZE; + break; +#endif +#ifdef DLT_IPV6 + case DLT_IPV6: + link_offset = RAWHDR_SIZE; + break; +#endif +#ifdef DLT_LINUX_SLL case DLT_LINUX_SLL: link_offset = ISDNHDR_SIZE; break; +#endif -#if HAVE_DLT_IEEE802_11_RADIO +#ifdef DLT_IEEE802_11_RADIO case DLT_IEEE802_11_RADIO: radiotap_present = 1; #endif -#if HAVE_DLT_IEEE802_11 +#ifdef DLT_IEEE802_11 case DLT_IEEE802_11: link_offset = IEEE80211HDR_SIZE; break; @@ -770,7 +831,7 @@ unsigned char *data, *datatcp; uint32_t len = h->caplen; -#if HAVE_DLT_IEEE802_11_RADIO +#if defined(DLT_IEEE802_11_RADIO) if (radiotap_present) { uint16_t radio_len = ((struct SIPGREP_rtaphdr_t *) (p))->it_len; ip4_pkt = (struct ip *) (p + link_offset + radio_len); @@ -2093,14 +2154,14 @@ " -s is set the bpf caplen\n" " -S is set the limitlen on matched packets\n" " -C is no colors in stdout\n" - " -c is search user in Contact: header\n" - " -f is search user in From: header\n" - " -t is search user in To: header\n" + " -c is search user in Contact: header (AND with match expression)\n" + " -f is search user in From: header (AND with match expression)\n" + " -t is search user in To: header (AND with match expression)\n" " -F is read the bpf filter from the specified file\n" " -H is homer sipcapture URL (i.e. udp:10.0.0.1:9061)\n" " -N is show sub protocol number\n" " -g is disabled clean up dialogs during trace\n" - " -G is print dialog report during clean up\n" + " -G is print dialog report during clean up (no per-packet dump)\n" " -J is kill friendly scanner automatically\n" " -j is kill friendly scanner automatically matching user agent string\n" " -K is kill friendly scanner providing IP and port/portrange i.e.: 10.0.0.1:5060-5090\n" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sipgrep-2.2.0/src/sipparse.c new/sipgrep-2.2.4/src/sipparse.c --- old/sipgrep-2.2.0/src/sipparse.c 2024-03-21 12:06:27.000000000 +0100 +++ new/sipgrep-2.2.4/src/sipparse.c 2026-08-22 23:45:23.000000000 +0200 @@ -3,7 +3,7 @@ * sipgrep - Monitoring tools * * Author: Alexandr Dubovikov <[email protected]> - * (C) Homer Project 2014 (http://www.sipcapture.org) + * (C) Homer Project 2014-2026 (http://www.sipcapture.org) * * Sipgrep is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -121,7 +121,16 @@ break; } } - memcpy (psip->reason, tmp + 12, reason - (tmp + sipLen + codeLen + 1 /*that's covering /r/n */ )); + { + /* Reason phrase length is attacker-controlled (raw wire bytes up to CRLF). + * Clamp to the fixed destination buffer to avoid a stack overflow of + * psip->reason[] (CWE-787). */ + long reason_len = reason - (tmp + sipLen + codeLen + 1 /*that's covering /r/n */ ); + if (reason_len < 0) reason_len = 0; + if ((size_t) reason_len > sizeof (psip->reason) - 1) + reason_len = sizeof (psip->reason) - 1; + memcpy (psip->reason, tmp + 12, (size_t) reason_len); + } } else { @@ -304,7 +313,12 @@ } } char contentLengthStr[32] = { 0 }; - memcpy (contentLengthStr, tmp + 16, offset4); + /* offset4 is attacker-controlled (Content-Length header line length). + * Clamp to the fixed local buffer to avoid a stack overflow (CWE-787). */ + if (offset4 < 0) offset4 = 0; + if ((size_t) offset4 > sizeof (contentLengthStr) - 1) + offset4 = sizeof (contentLengthStr) - 1; + memcpy (contentLengthStr, tmp + 16, (size_t) offset4); contentLength = atoi (contentLengthStr); } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sipgrep-2.2.0/src/tcpreasm.c new/sipgrep-2.2.4/src/tcpreasm.c --- old/sipgrep-2.2.0/src/tcpreasm.c 2024-03-21 12:06:27.000000000 +0100 +++ new/sipgrep-2.2.4/src/tcpreasm.c 2026-08-22 23:45:23.000000000 +0200 @@ -3,7 +3,7 @@ * added tcp stream reassembling * * Copyright (c) 2007 Jan Andres <[email protected]> - * Copyright (c) 2014 Alexandr Dubovikov <[email protected]> + * Copyright (c) 2014-2026 Alexandr Dubovikov <[email protected]> * */ @@ -16,6 +16,12 @@ #include "config.h" #endif /* HAVE_CONFIG_H */ +#include <sys/types.h> +#include <sys/socket.h> +#include <netinet/in.h> +#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__APPLE__) || defined(__sun) || defined(OS_FREEBSD) || defined(OS_SOLARIS) || defined(OS_DARWIN) || defined(OS_NETBSD) +#include <netinet/in_systm.h> +#endif #include <netinet/ip.h> #include <netinet/udp.h> #if USE_IPv6 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sipgrep-2.2.0/src/test_sipparse_bounds.c new/sipgrep-2.2.4/src/test_sipparse_bounds.c --- old/sipgrep-2.2.0/src/test_sipparse_bounds.c 1970-01-01 01:00:00.000000000 +0100 +++ new/sipgrep-2.2.4/src/test_sipparse_bounds.c 2026-08-22 23:45:23.000000000 +0200 @@ -0,0 +1,89 @@ +/* + * Regression tests for bounded copies in parse_message(). + * Build (from src/): + * gcc -fsanitize=address,undefined -O1 -g -I. \ + * -o test_sipparse_bounds test_sipparse_bounds.c sipparse.c + */ + +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include "include/sipparse.h" + +static int failures = 0; + +static void +expect (int ok, const char *msg) +{ + if (!ok) { + fprintf (stderr, "FAIL: %s\n", msg); + failures++; + } +} + +static void +parse_buf (const char *msg, struct preparsed_sip *psip) +{ + unsigned int bytes_parsed = 0; + + memset (psip, 0, sizeof (*psip)); + parse_message ((unsigned char *) msg, (unsigned int) strlen (msg), &bytes_parsed, psip); +} + +int +main (void) +{ + struct preparsed_sip psip; + char buf[1024]; + char long_reason[301]; + char long_cl[102]; + + /* Well-formed reply: reason must parse as "OK". */ + parse_buf ("SIP/2.0 200 OK\r\n" + "Call-ID: abc-123\r\n" + "CSeq: 1 INVITE\r\n" + "Content-Length: 0\r\n" + "\r\n", &psip); + expect (psip.is_method == SIP_REPLY, "valid: is SIP_REPLY"); + expect (psip.reply == 200, "valid: reply 200"); + expect (strcmp (psip.reason, "OK") == 0, "valid: reason OK"); + expect (psip.callid.len > 0 && psip.callid.s != NULL, "valid: callid present"); + + /* Oversized reason phrase must truncate, not overflow adjacent callid. */ + memset (long_reason, 'A', sizeof (long_reason) - 1); + long_reason[sizeof (long_reason) - 1] = '\0'; + snprintf (buf, sizeof (buf), + "SIP/2.0 200 %s\r\n" + "Call-ID: abc-123\r\n" + "CSeq: 1 INVITE\r\n" + "Content-Length: 0\r\n" + "\r\n", long_reason); + parse_buf (buf, &psip); + expect (psip.reply == 200, "long reason: reply 200"); + expect (strlen (psip.reason) == 31, "long reason: truncated to 31"); + expect (strspn (psip.reason, "A") == 31, "long reason: only A's"); + expect (psip.callid.s != NULL && psip.callid.len > 0, "long reason: callid intact"); + expect (psip.callid.len >= 7 && memcmp (psip.callid.s, "abc-123", 7) == 0, + "long reason: callid value"); + + /* Oversized Content-Length value must not overflow the local buffer. */ + memset (long_cl, '9', sizeof (long_cl) - 1); + long_cl[sizeof (long_cl) - 1] = '\0'; + snprintf (buf, sizeof (buf), + "SIP/2.0 200 OK\r\n" + "Call-ID: abc-123\r\n" + "CSeq: 1 INVITE\r\n" + "Content-Length: %s\r\n" + "\r\n", long_cl); + parse_buf (buf, &psip); + expect (psip.reply == 200, "long Content-Length: reply 200"); + expect (strcmp (psip.reason, "OK") == 0, "long Content-Length: reason OK"); + expect (psip.callid.s != NULL && psip.callid.len > 0, "long Content-Length: callid intact"); + + if (failures) { + fprintf (stderr, "%d failure(s)\n", failures); + return 1; + } + printf ("ok\n"); + return 0; +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sipgrep-2.2.0/src/transport_hep.c new/sipgrep-2.2.4/src/transport_hep.c --- old/sipgrep-2.2.0/src/transport_hep.c 2024-03-21 12:06:27.000000000 +0100 +++ new/sipgrep-2.2.4/src/transport_hep.c 2026-08-22 23:45:23.000000000 +0200 @@ -2,7 +2,7 @@ * sipgrep - Monitoring tools * * Author: Alexandr Dubovikov <[email protected]> - * (C) Homer Project 2014-16 (http://www.sipcapture.org) + * (C) Homer Project 2014-2026 (http://www.sipcapture.org) * * Sipgrep is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ - +#include <arpa/inet.h> #include <sys/socket.h> #include <stdlib.h> #include <stdio.h> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sipgrep-2.2.0/src/user_interface.c new/sipgrep-2.2.4/src/user_interface.c --- old/sipgrep-2.2.0/src/user_interface.c 2024-03-21 12:06:27.000000000 +0100 +++ new/sipgrep-2.2.4/src/user_interface.c 2026-08-22 23:45:23.000000000 +0200 @@ -2,7 +2,7 @@ * sipgrep - Monitoring tools * * Author: Alexandr Dubovikov <[email protected]> - * (C) Homer Project 2014-16 (http://www.sipcapture.org) + * (C) Homer Project 2014-2026 (http://www.sipcapture.org) * * Sipgrep is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by
