Hello community, here is the log from the commit of package sngrep for openSUSE:Factory checked in at 2020-11-17 21:25:05 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/sngrep (Old) and /work/SRC/openSUSE:Factory/.sngrep.new.24930 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "sngrep" Tue Nov 17 21:25:05 2020 rev:4 rq:848728 version:1.4.8 Changes: -------- --- /work/SRC/openSUSE:Factory/sngrep/sngrep.changes 2020-05-29 21:39:04.846954156 +0200 +++ /work/SRC/openSUSE:Factory/.sngrep.new.24930/sngrep.changes 2020-11-17 21:25:07.797368554 +0100 @@ -1,0 +2,12 @@ +Wed Nov 11 14:35:13 UTC 2020 - Martin Hauke <[email protected]> + +- Update to version 1.4.8 + * capture: add support for IPv6 SDP connection address + * capture: fixed a crash while parsing INVITES without R-URI + * capture: fixed a crash while parsing malformed Req/Resp lines + * call flow: improved IPv6 RTP columns address display + * core: code cleanup removing unused variables + * core: fixed multiple snprintf memory overflows + * core: avoid crash when linking against ncurses without tinfo + +------------------------------------------------------------------- Old: ---- sngrep-1.4.7.tar.gz New: ---- sngrep-1.4.8.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ sngrep.spec ++++++ --- /var/tmp/diff_new_pack.WyG8Hm/_old 2020-11-17 21:25:08.389369142 +0100 +++ /var/tmp/diff_new_pack.WyG8Hm/_new 2020-11-17 21:25:08.393369146 +0100 @@ -2,7 +2,7 @@ # spec file for package sngrep # # Copyright (c) 2020 SUSE LLC -# Copyright (c) 2018, Martin Hauke <[email protected]> +# Copyright (c) 2018-2020, Martin Hauke <[email protected]> # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,7 +18,7 @@ Name: sngrep -Version: 1.4.7 +Version: 1.4.8 Release: 0 Summary: Ncurses SIP Messages flow viewer License: GPL-3.0-or-later ++++++ sngrep-1.4.7.tar.gz -> sngrep-1.4.8.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sngrep-1.4.7/ChangeLog new/sngrep-1.4.8/ChangeLog --- old/sngrep-1.4.7/ChangeLog 2020-05-21 11:48:47.000000000 +0200 +++ new/sngrep-1.4.8/ChangeLog 2020-11-10 10:53:53.000000000 +0100 @@ -1,3 +1,15 @@ +2020-11-10 Ivan Alonso <[email protected]> + * sngrep 1.4.8 released + + * capture: add support for IPv6 SDP connection address + * capture: fixed a crash while parsing INVITES without R-URI + * capture: fixed a crash while parsing malformed Req/Resp lines + * call flow: improved IPv6 RTP columns address display + * core: code cleanup removing unused variables + * core: fixed multiple snprintf memory overflows + * core: avoid crash when linking against ncurses without tinfo + + 2020-05-21 Ivan Alonso <[email protected]> * sngrep 1.4.7 released diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sngrep-1.4.7/configure.ac new/sngrep-1.4.8/configure.ac --- old/sngrep-1.4.7/configure.ac 2020-05-21 11:48:47.000000000 +0200 +++ new/sngrep-1.4.8/configure.ac 2020-11-10 10:53:53.000000000 +0100 @@ -1,5 +1,5 @@ AC_PREREQ([2.59]) -AC_INIT([sngrep], [1.4.7], [[email protected]], [sngrep], [http://www.irontec.com/]) +AC_INIT([sngrep], [1.4.8], [[email protected]], [sngrep], [http://www.irontec.com/]) AM_INIT_AUTOMAKE([1.9]) AC_CONFIG_HEADERS([src/config.h]) m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) @@ -74,6 +74,10 @@ AC_CHECK_LIB([menuw], [new_item], [], [ AC_MSG_ERROR([ You need to have ncurses menuw library installed to compile sngrep.]) ]) + + AC_SEARCH_LIBS([keyname], [tinfow], [], [ + AC_MSG_ERROR([ You need to have ncurses tinfow library installed to compile sngrep.]) + ]) ], [ # Ncurses without wide-character support @@ -96,6 +100,10 @@ AC_CHECK_LIB([menu], [new_item], [], [ AC_MSG_ERROR([ You need to have ncurses menu library installed to compile sngrep.]) ]) + + AC_SEARCH_LIBS([keyname], [tinfo], [], [ + AC_MSG_ERROR([ You need to have ncurses tinfo library installed to compile sngrep.]) + ]) ]) #### diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sngrep-1.4.7/doc/sngrep.8 new/sngrep-1.4.8/doc/sngrep.8 --- old/sngrep-1.4.7/doc/sngrep.8 2020-05-21 11:48:47.000000000 +0200 +++ new/sngrep-1.4.8/doc/sngrep.8 2020-11-10 10:53:53.000000000 +0100 @@ -1,9 +1,9 @@ .\" Man page for the sngrep .\" -.\" Copyright (c) 2013-2019 Ivan Alonso <[email protected]> -.\" Copyright (c) 2013-2019 Irontec S.L. +.\" Copyright (c) 2013-2020 Ivan Alonso <[email protected]> +.\" Copyright (c) 2013-2020 Irontec S.L. -.TH SNGREP 8 "May 2020" "sngrep 1.4.7" +.TH SNGREP 8 "Nov 2020" "sngrep 1.4.8" .SH NAME diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sngrep-1.4.7/m4/sngrep.m4 new/sngrep-1.4.8/m4/sngrep.m4 --- old/sngrep-1.4.7/m4/sngrep.m4 2020-05-21 11:48:47.000000000 +0200 +++ new/sngrep-1.4.8/m4/sngrep.m4 2020-11-10 10:53:53.000000000 +0100 @@ -44,7 +44,7 @@ LIBS="$sngrep_config_script $LIBS " sngrep_script_success=yes ], []) - LDFLAGS="$save_LDFLAGS" + LDFLAGS="$sngrep_save_LDFLAGS" fi if test "x$sngrep_script_success" = xno; then [$5] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sngrep-1.4.7/pkg/debian/changelog new/sngrep-1.4.8/pkg/debian/changelog --- old/sngrep-1.4.7/pkg/debian/changelog 2020-05-21 11:48:47.000000000 +0200 +++ new/sngrep-1.4.8/pkg/debian/changelog 2020-11-10 10:53:53.000000000 +0100 @@ -1,3 +1,9 @@ +sngrep (1.4.8) experimental; urgency=low + + * sngrep 1.4.8 released + + -- Ivan Alonso <[email protected]> Tue, 10 Oct 2020 10:46:10 +0200 + sngrep (1.4.7) experimental; urgency=low * sngrep 1.4.7 released diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sngrep-1.4.7/pkg/rpm/SPECS/sngrep.spec new/sngrep-1.4.8/pkg/rpm/SPECS/sngrep.spec --- old/sngrep-1.4.7/pkg/rpm/SPECS/sngrep.spec 2020-05-21 11:48:47.000000000 +0200 +++ new/sngrep-1.4.8/pkg/rpm/SPECS/sngrep.spec 2020-11-10 10:53:53.000000000 +0100 @@ -2,12 +2,12 @@ Summary: SIP Messages flow viewer Name: sngrep -Version: 1.4.7 +Version: 1.4.8 Release: 0%{?dist} License: GPLv3 Group: Applications/Engineering BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root -Source: https://github.com/irontec/%{name}/archive/v%{version}.zip +Source: https://github.com/irontec/sngrep/releases/download/v%{version}/sngrep-%{version}.tar.gz URL: http://github.com/irontec/sngrep BuildRequires: ncurses-devel BuildRequires: make @@ -59,6 +59,8 @@ %{__rm} -rf %{buildroot} %changelog +* Tue Oct 10 2020 Ivan Alonso <[email protected]> - 1.4.8 + - Version 1.4.8 * Thu May 21 2020 Ivan Alonso <[email protected]> - 1.4.7 - Version 1.4.7 * Wed Oct 31 2018 Ivan Alonso <[email protected]> - 1.4.6 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sngrep-1.4.7/src/address.c new/sngrep-1.4.8/src/address.c --- old/sngrep-1.4.7/src/address.c 2020-05-21 11:48:47.000000000 +0200 +++ new/sngrep-1.4.8/src/address.c 2020-11-10 10:53:53.000000000 +0100 @@ -29,6 +29,7 @@ #include "config.h" #include "address.h" +#include "util.h" #include <string.h> #include <pcap.h> #include <sys/socket.h> @@ -105,7 +106,7 @@ { address_t ret = {}; char scanipport[256]; - char address[256]; + char address[ADDRESSLEN + 1]; int port; if (!ipport || strlen(ipport) > ADDRESSLEN + 6) @@ -113,7 +114,7 @@ strncpy(scanipport, ipport, sizeof(scanipport)); - if (sscanf(scanipport, "%[^:]:%d", address, &port) == 2) { + if (sscanf(scanipport, "%" STRINGIFY(ADDRESSLEN) "[^:]:%d", address, &port) == 2) { strncpy(ret.ip, address, sizeof(ret.ip)); ret.port = port; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sngrep-1.4.7/src/capture.c new/sngrep-1.4.8/src/capture.c --- old/sngrep-1.4.7/src/capture.c 2020-05-21 11:48:47.000000000 +0200 +++ new/sngrep-1.4.8/src/capture.c 2020-11-10 10:53:53.000000000 +0100 @@ -697,7 +697,6 @@ capture_ws_check_packet(packet_t *packet) { int ws_off = 0; - u_char ws_fin; u_char ws_opcode; u_char ws_mask; uint8_t ws_len; @@ -737,7 +736,6 @@ return 0; // Flags && Opcode - ws_fin = (*payload & WH_FIN) >> 4; ws_opcode = *payload & WH_OPCODE; ws_off++; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sngrep-1.4.7/src/capture_eep.c new/sngrep-1.4.8/src/capture_eep.c --- old/sngrep-1.4.7/src/capture_eep.c 2020-05-21 11:48:47.000000000 +0200 +++ new/sngrep-1.4.8/src/capture_eep.c 2020-11-10 10:53:53.000000000 +0100 @@ -610,7 +610,6 @@ #endif hep_chunk_t payload_chunk; hep_chunk_t authkey_chunk; - hep_chunk_t uuid_chunk; char password[100]; int password_len; unsigned char *payload = 0; @@ -762,13 +761,13 @@ capture_eep_set_server_url(const char *url) { char urlstr[256]; - char address[256], port[256]; + char address[ADDRESSLEN + 1], port[6]; memset(address, 0, sizeof(address)); memset(port, 0, sizeof(port)); strncpy(urlstr, url, sizeof(urlstr)); - if (sscanf(urlstr, "%*[^:]:%[^:]:%s", address, port) == 2) { + if (sscanf(urlstr, "%*[^:]:%" STRINGIFY(ADDRESSLEN) "[^:]:%5s", address, port) == 2) { setting_set_value(SETTING_EEP_LISTEN, SETTING_ON); setting_set_value(SETTING_EEP_LISTEN_ADDR, address); setting_set_value(SETTING_EEP_LISTEN_PORT, port); @@ -781,13 +780,13 @@ capture_eep_set_client_url(const char *url) { char urlstr[256]; - char address[256], port[256]; + char address[ADDRESSLEN + 1], port[6]; memset(address, 0, sizeof(address)); memset(port, 0, sizeof(port)); strncpy(urlstr, url, sizeof(urlstr)); - if (sscanf(urlstr, "%*[^:]:%[^:]:%s", address, port) == 2) { + if (sscanf(urlstr, "%*[^:]:%" STRINGIFY(ADDRESSLEN) "[^:]:%5s", address, port) == 2) { setting_set_value(SETTING_EEP_SEND, SETTING_ON); setting_set_value(SETTING_EEP_SEND_ADDR, address); setting_set_value(SETTING_EEP_SEND_PORT, port); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sngrep-1.4.7/src/curses/ui_call_flow.c new/sngrep-1.4.8/src/curses/ui_call_flow.c --- old/sngrep-1.4.7/src/curses/ui_call_flow.c 2020-05-21 11:48:47.000000000 +0200 +++ new/sngrep-1.4.8/src/curses/ui_call_flow.c 2020-11-10 10:53:53.000000000 +0100 @@ -39,6 +39,8 @@ #include "vector.h" #include "option.h" +#define METHOD_MAXLEN 80 + /*** * * Some basic ascii art of this panel. @@ -226,11 +228,6 @@ void call_flow_draw_footer(ui_t *ui) { - call_flow_info_t *info; - - // Get panel information - info = call_flow_info(ui); - const char *keybindings[] = { key_action_key_str(ACTION_PREV_SCREEN), "Calls List", key_action_key_str(ACTION_CONFIRM), "Raw", @@ -429,7 +426,7 @@ char msg_time[80]; address_t src; address_t dst; - char method[80]; + char method[METHOD_MAXLEN + 1]; char delta[15] = {}; int flowh, floww; char mediastr[40]; @@ -439,6 +436,9 @@ int msglen; int aline = cline + 1; + // Initialize method + memset(method, 0, sizeof(method)); + // Get panel information info = call_flow_info(ui); @@ -465,33 +465,33 @@ timeval_to_time(msg_get_time(msg), msg_time); // Get Message method (include extra info) - sprintf(method, "%s", msg_method); + snprintf(method, METHOD_MAXLEN, "%s", msg_method); // If message has sdp information if (msg_has_sdp(msg) && setting_has_value(SETTING_CF_SDP_INFO, "off")) { // Show sdp tag in title - sprintf(method, "%s (SDP)", msg_method); + snprintf(method, METHOD_MAXLEN, "%s (SDP)", msg_method ); } // If message has sdp information if (setting_has_value(SETTING_CF_SDP_INFO, "compressed")) { // Show sdp tag in title if (msg_has_sdp(msg)) { - sprintf(method, "%.*s (SDP)", 12, msg_method); + snprintf(method, METHOD_MAXLEN, "%.*s (SDP)", 12, msg_method); } else { - sprintf(method, "%.*s", 17, msg_method); + snprintf(method, METHOD_MAXLEN, "%.*s", 17, msg_method); } } if (msg_has_sdp(msg) && setting_has_value(SETTING_CF_SDP_INFO, "first")) { - sprintf(method, "%.3s (%s:%u)", - msg_method, - media->address.ip, - media->address.port); + snprintf(method, METHOD_MAXLEN, "%.3s (%s:%u)", + msg_method, + media->address.ip, + media->address.port); } if (msg_has_sdp(msg) && setting_has_value(SETTING_CF_SDP_INFO, "full")) { - sprintf(method, "%.3s (%s)", msg_method, media->address.ip); + snprintf(method, METHOD_MAXLEN, "%.3s (%s)", msg_method, media->address.ip); } // Draw message type or status and line @@ -674,7 +674,6 @@ WINDOW *win; char text[50], time[20]; int height, width; - const char *callid; rtp_stream_t *stream = arrow->item; sip_msg_t *msg; sip_call_t *call; @@ -702,7 +701,6 @@ // Get message data call = stream->media->msg->call; - callid = call->callid; /** * This logic will try to use the same columns for the stream representation @@ -881,14 +879,10 @@ call_flow_arrow_create(ui_t *ui, void *item, int type) { call_flow_arrow_t *arrow; - call_flow_info_t *info; if ((arrow = call_flow_arrow_find(ui, item))) return arrow; - // Get panel information - info = call_flow_info(ui); - // Create a new arrow of the given type arrow = malloc(sizeof(call_flow_arrow_t)); memset(arrow, 0, sizeof(call_flow_arrow_t)); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sngrep-1.4.7/src/curses/ui_call_list.c new/sngrep-1.4.8/src/curses/ui_call_list.c --- old/sngrep-1.4.7/src/curses/ui_call_list.c 2020-05-21 11:48:47.000000000 +0200 +++ new/sngrep-1.4.8/src/curses/ui_call_list.c 2020-11-10 10:53:53.000000000 +0100 @@ -746,16 +746,12 @@ int call_list_handle_form_key(ui_t *ui, int key) { - int field_idx; char *dfilter; int action = -1; // Get panel information call_list_info_t *info = call_list_info(ui); - // Get current field id - field_idx = field_index(current_field(info->form)); - // Check actions for this key while ((action = key_find_action(key, action)) != ERR) { // Check if we handle this action @@ -836,8 +832,7 @@ call_list_handle_menu_key(ui_t *ui, int key) { MENU *menu; - ITEM *current; - int current_idx, i; + int i; int action = -1; sip_sort_t sort; enum sip_attr_id id; @@ -846,8 +841,6 @@ call_list_info_t *info = call_list_info(ui); menu = info->menu; - current = current_item(menu); - current_idx = item_index(current); // Check actions for this key while ((action = key_find_action(key, action)) != ERR) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sngrep-1.4.7/src/curses/ui_filter.c new/sngrep-1.4.8/src/curses/ui_filter.c --- old/sngrep-1.4.7/src/curses/ui_filter.c 2020-05-21 11:48:47.000000000 +0200 +++ new/sngrep-1.4.8/src/curses/ui_filter.c 2020-11-10 10:53:53.000000000 +0100 @@ -400,7 +400,7 @@ const char* filter_field_method(int field_id) { - int method; + int method = 0; switch(field_id) { case FLD_FILTER_REGISTER: method = SIP_METHOD_REGISTER; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sngrep-1.4.7/src/curses/ui_settings.c new/sngrep-1.4.8/src/curses/ui_settings.c --- old/sngrep-1.4.7/src/curses/ui_settings.c 2020-05-21 11:48:47.000000000 +0200 +++ new/sngrep-1.4.8/src/curses/ui_settings.c 2020-11-10 10:53:53.000000000 +0100 @@ -97,7 +97,7 @@ { int i, j, line; settings_info_t *info; - FIELD *entry, *label; + FIELD *entry = NULL, *label; int field = 0; // Cerate a new window for the panel and form @@ -218,7 +218,6 @@ int settings_draw(ui_t *ui) { - int field_idx; int i; int cury, curx; @@ -229,9 +228,6 @@ // Store cursor position getyx(ui->win, cury, curx); - // Get current field id - field_idx = field_index(current_field(info->form)); - // Print category headers int colpos = 2; for (i = 0; categories[i].cat_id; i++) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sngrep-1.4.7/src/media.c new/sngrep-1.4.8/src/media.c --- old/sngrep-1.4.7/src/media.c 2020-05-21 11:48:47.000000000 +0200 +++ new/sngrep-1.4.8/src/media.c 2020-11-10 10:53:53.000000000 +0100 @@ -62,7 +62,7 @@ void media_set_type(sdp_media_t *media, const char *type) { - strcpy(media->type, type); + strncpy(media->type, type, MEDIATYPELEN - 1); } void diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sngrep-1.4.7/src/option.c new/sngrep-1.4.8/src/option.c --- old/sngrep-1.4.7/src/option.c 2020-05-21 11:48:47.000000000 +0200 +++ new/sngrep-1.4.8/src/option.c 2020-11-10 10:53:53.000000000 +0100 @@ -121,7 +121,7 @@ continue; // Get configuration option from setting line - if (sscanf(line, "%s %s %[^\t\n]", type, option, value) == 3) { + if (sscanf(line, "%19s %49s %49[^\t\n]", type, option, value) == 3) { if (!strcasecmp(type, "set")) { if ((id = setting_id(option)) >= 0) { setting_set_value(id, value); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sngrep-1.4.7/src/rtp.c new/sngrep-1.4.8/src/rtp.c --- old/sngrep-1.4.7/src/rtp.c 2020-05-21 11:48:47.000000000 +0200 +++ new/sngrep-1.4.8/src/rtp.c 2020-11-10 10:53:53.000000000 +0100 @@ -249,7 +249,7 @@ stream_add_packet(stream, packet); } else if (data_is_rtcp(payload, size) == 0) { // Find the matching stream - if ((stream = rtp_find_stream(src, dst))) { + if ((stream = rtp_find_rtcp_stream(src, dst))) { // Parse all packet payload headers while ((int32_t) size > 0) { @@ -379,7 +379,7 @@ } rtp_stream_t * -rtp_find_stream(address_t src, address_t dst) +rtp_find_rtcp_stream(address_t src, address_t dst) { // Structure for RTP packet streams rtp_stream_t *stream; @@ -395,6 +395,8 @@ while ((call = vector_iterator_prev(&calls))) { // Check if this call has an RTP stream for current packet data if ((stream = rtp_find_call_stream(call, src, dst))) { + if (stream->type != PACKET_RTCP) + continue; return stream; } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sngrep-1.4.7/src/rtp.h new/sngrep-1.4.8/src/rtp.h --- old/sngrep-1.4.7/src/rtp.h 2020-05-21 11:48:47.000000000 +0200 +++ new/sngrep-1.4.8/src/rtp.h 2020-11-10 10:53:53.000000000 +0100 @@ -304,7 +304,7 @@ rtp_find_stream_format(address_t src, address_t dst, uint32_t format); rtp_stream_t * -rtp_find_stream(address_t src, address_t dst); +rtp_find_rtcp_stream(address_t src, address_t dst); rtp_stream_t * rtp_find_call_stream(struct sip_call *call, address_t src, address_t dst); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sngrep-1.4.7/src/sip.c new/sngrep-1.4.8/src/sip.c --- old/sngrep-1.4.7/src/sip.c 2020-05-21 11:48:47.000000000 +0200 +++ new/sngrep-1.4.8/src/sip.c 2020-11-10 10:53:53.000000000 +0100 @@ -171,7 +171,7 @@ // Initialize payload parsing regexp match_flags = REG_EXTENDED | REG_ICASE | REG_NEWLINE; - regcomp(&calls.reg_method, "^([a-zA-Z]+) [a-zA-Z]+:.+ SIP/2.0[ ]*\r", match_flags & ~REG_NEWLINE); + regcomp(&calls.reg_method, "^([a-zA-Z]+) [a-zA-Z]+:.* SIP/2.0[ ]*\r", match_flags & ~REG_NEWLINE); regcomp(&calls.reg_callid, "^(Call-ID|i):[ ]*([^ ]+)[ ]*\r$", match_flags); setting = setting_get_value(SETTING_SIP_HEADER_X_CID); reg_rule_len = strlen(setting) + 22; @@ -328,7 +328,6 @@ sip_msg_t *msg; sip_call_t *call; char callid[1024], xcallid[1024]; - address_t src, dst; u_char payload[MAX_SIP_PAYLOAD]; bool newcall = false; @@ -336,10 +335,6 @@ if (packet->payload_len > MAX_SIP_PAYLOAD) return NULL; - // Get Addresses from packet - src = packet->src; - dst = packet->dst; - // Initialize local variables memset(callid, 0, sizeof(callid)); memset(xcallid, 0, sizeof(xcallid)); @@ -654,8 +649,9 @@ address_t dst, src = { }; rtp_stream_t *rtp_stream = NULL, *rtcp_stream = NULL, *msg_rtp_stream = NULL; - char media_type[MEDIATYPELEN] = { }; + char media_type[MEDIATYPELEN + 1] = { }; char media_format[30] = { }; + char address[ADDRESSLEN + 1] = { }; uint32_t media_fmt_pref; uint32_t media_fmt_code; sdp_media_t *media = NULL; @@ -674,8 +670,8 @@ while ((line = strsep(&payload2, "\r\n")) != NULL) { // Check if we have a media string if (!strncmp(line, "m=", 2)) { - if (sscanf(line, "m=%s %hu RTP/%*s %u", media_type, &dst.port, &media_fmt_pref) == 3 - || sscanf(line, "m=%s %hu UDP/%*s %u", media_type, &dst.port, &media_fmt_pref) == 3) { + if (sscanf(line, "m=%" STRINGIFY(MEDIATYPELEN) "s %hu RTP/%*s %u", media_type, &dst.port, &media_fmt_pref) == 3 + || sscanf(line, "m=%" STRINGIFY(MEDIATYPELEN) "s %hu UDP/%*s %u", media_type, &dst.port, &media_fmt_pref) == 3) { // Add streams from previous 'm=' line to the call ADD_STREAM(msg_rtp_stream); @@ -713,16 +709,19 @@ // Check if we have a connection string if (!strncmp(line, "c=", 2)) { - if (sscanf(line, "c=IN IP4 %s", dst.ip) && media) { - media_set_address(media, dst); - strcpy(rtp_stream->dst.ip, dst.ip); - strcpy(rtcp_stream->dst.ip, dst.ip); + if (sscanf(line, "c=IN IP%*c %" STRINGIFY(ADDRESSLEN) "s", address)) { + strncpy(dst.ip, address, ADDRESSLEN - 1); + if (media) { + media_set_address(media, dst); + strcpy(rtp_stream->dst.ip, dst.ip); + strcpy(rtcp_stream->dst.ip, dst.ip); + } } } // Check if we have attribute format string if (!strncmp(line, "a=rtpmap:", 9)) { - if (media && sscanf(line, "a=rtpmap:%u %30[^ ]", &media_fmt_code, media_format)) { + if (media && sscanf(line, "a=rtpmap:%u %29[^ ]", &media_fmt_code, media_format)) { media_add_format(media, media_fmt_code, media_format); } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sngrep-1.4.7/src/sip_call.c new/sngrep-1.4.8/src/sip_call.c --- old/sngrep-1.4.7/src/sip_call.c 2020-05-21 11:48:47.000000000 +0200 +++ new/sngrep-1.4.8/src/sip_call.c 2020-11-10 10:53:53.000000000 +0100 @@ -197,14 +197,10 @@ call_update_state(sip_call_t *call, sip_msg_t *msg) { int reqresp; - sip_msg_t *first; if (!call_is_invite(call)) return; - // Get the first message in the call - first = vector_first(call->msgs); - // Get current message Method / Response Code reqresp = msg->reqresp; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sngrep-1.4.7/src/sip_msg.c new/sngrep-1.4.8/src/sip_msg.c --- old/sngrep-1.4.7/src/sip_msg.c 2020-05-21 11:48:47.000000000 +0200 +++ new/sngrep-1.4.8/src/sip_msg.c 2020-11-10 10:53:53.000000000 +0100 @@ -120,10 +120,18 @@ switch (id) { case SIP_ATTR_SRC: - sprintf(value, "%s:%u", msg->packet->src.ip, msg->packet->src.port); + if (msg->packet->ip_version == 6) { + sprintf(value, "[%s]:%u", msg->packet->src.ip, msg->packet->src.port); + } else { + sprintf(value, "%s:%u", msg->packet->src.ip, msg->packet->src.port); + } break; case SIP_ATTR_DST: - sprintf(value, "%s:%u", msg->packet->dst.ip, msg->packet->dst.port); + if (msg->packet->ip_version == 6) { + sprintf(value, "[%s]:%u", msg->packet->dst.ip, msg->packet->dst.port); + } else { + sprintf(value, "%s:%u", msg->packet->dst.ip, msg->packet->dst.port); + } break; case SIP_ATTR_METHOD: sprintf(value, "%.*s", SIP_ATTR_MAXLEN, sip_get_msg_reqresp_str(msg)); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sngrep-1.4.7/src/util.h new/sngrep-1.4.8/src/util.h --- old/sngrep-1.4.7/src/util.h 2020-05-21 11:48:47.000000000 +0200 +++ new/sngrep-1.4.8/src/util.h 2020-11-10 10:53:53.000000000 +0100 @@ -35,6 +35,9 @@ // Max Memmory allocation #define MALLOC_MAX_SIZE 102400 +// Stringify numbers for concatenation +#define STRINGIFY_ARG(x) #x +#define STRINGIFY(x) STRINGIFY_ARG(x) /** * @brief Wrapper for memory allocation _______________________________________________ openSUSE Commits mailing list -- [email protected] To unsubscribe, email [email protected] List Netiquette: https://en.opensuse.org/openSUSE:Mailing_list_netiquette List Archives: https://lists.opensuse.org/archives/list/[email protected]
