Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 29 Nov 2007 13:42:03 +0100 (CET)
From:      Stefan Esser <se@FreeBSD.org>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   ports/118327: [PATCH] Uprade SIPp port to new snapshot (bug fixes)
Message-ID:  <20071129124203.DE4A18BF@se-scan.cgn.atsec>
Resent-Message-ID: <200711291300.lATD059K078737@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         118327
>Category:       ports
>Synopsis:       [PATCH] Uprade SIPp port to new snapshot (bug fixes)
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          update
>Submitter-Id:   current-users
>Arrival-Date:   Thu Nov 29 13:00:05 UTC 2007
>Closed-Date:
>Last-Modified:
>Originator:     Stefan Esser
>Release:        FreeBSD 7.0-BETA3 i386
>Organization:
>Environment:
System: FreeBSD se-test 7.0-BETA3 FreeBSD 7.0-BETA3 #5: Thu Nov 22 13:57:32 CET 2007 se@se-test:/usr/src/sys/i386/compile/SE-TEST i386
>Description:
The current SIPp port builds a snapshot with a number of bugs that have
been fxied in the mean-time. One of these bugs made me loose two days 
until I understood why authentication was not working with credentials
passed on the command line.
This version does also contain other bugs which might allow a response 
to overflow a buffer (string is copied without terminating NUL byte).
I have not tested whether this bug is exploitable but this new port 
includes a fix.
>How-To-Repeat:
Start SIPp and try to authenticate against a SIP server or proxy with [auth]
in scenario and authentication parameters on command line.
>Fix:
Apply attached patch. Some of the patches in the port have been integrated
into the new snapshot. Delete zero length patches (remove them from the 
repository) after applying the patch.

Index: Makefile
===================================================================
RCS file: /usr/cvs/ports/net/sipp/Makefile,v
retrieving revision 1.21
diff -u -3 -r1.21 Makefile
--- Makefile	15 Sep 2007 01:25:25 -0000	1.21
+++ Makefile	22 Nov 2007 12:36:10 -0000
@@ -6,10 +6,10 @@
 #
 
 PORTNAME=	sipp
-PORTVERSION=	2.0.20070906
+PORTVERSION=	2.0.20071121
 CATEGORIES=	net
 MASTER_SITES=	http://sipp.sourceforge.net/snapshots/
-DISTNAME=	${PORTNAME}.2007-09-06
+DISTNAME=	${PORTNAME}.2007-11-21
 
 MAINTAINER=	tut@nhamon.com.ua
 COMMENT=	SIP testing tool
Index: distinfo
===================================================================
RCS file: /usr/cvs/ports/net/sipp/distinfo,v
retrieving revision 1.14
diff -u -3 -r1.14 distinfo
--- distinfo	15 Sep 2007 01:25:25 -0000	1.14
+++ distinfo	22 Nov 2007 12:36:29 -0000
@@ -1,3 +1,3 @@
-MD5 (sipp.2007-09-06.tar.gz) = b96d01b1435912ea65fd0092c98f130e
-SHA256 (sipp.2007-09-06.tar.gz) = b20de66bdd6b33b8d5441e3655f6e8f247dbcd40b9853e43ab9992f8122ff7eb
-SIZE (sipp.2007-09-06.tar.gz) = 197176
+MD5 (sipp.2007-11-21.tar.gz) = 3a1d65abe97301f61c4ec2c393465612
+SHA256 (sipp.2007-11-21.tar.gz) = 9a1fb352eae5068140d22f7924529f68a20564b7219e588a08608b45074e9196
+SIZE (sipp.2007-11-21.tar.gz) = 198049
Index: files/patch-Makefile
===================================================================
RCS file: /usr/cvs/ports/net/sipp/files/patch-Makefile,v
retrieving revision 1.8
diff -u -3 -r1.8 patch-Makefile
--- files/patch-Makefile	15 Sep 2007 01:25:25 -0000	1.8
+++ files/patch-Makefile	12 Nov 2007 12:54:14 -0000
@@ -54,24 +54,6 @@
  
  #Linker Flags
  LFLAGS_hpux=-AA -mt
-@@ -138,7 +136,7 @@
- LIBS_linux= -ldl -lpthread -lncurses -lstdc++ -lm -L /usr/local/lib -L /usr/lib -L /usr/lib64
- LIBS_hpux= -lcurses -lpthread -L /opt/openssl/lib -L /usr/local/lib
- LIBS_tru64= -lcurses -lpthread
--LIBS_freebsd= -lcurses -pthread
-+LIBS_freebsd= -lcurses -pthread -L /usr/local/lib
- LIBS_SunOS= -lcurses -lpthread -lnsl -lsocket -lstdc++ -lm -ldl -L /usr/local/ssl/lib/
- LIBS_Cygwin= -lcurses -lpthread -lstdc++ -L /usr/lib/WpdPack/Lib
- LIBS_Darwin= -lcurses
-@@ -146,7 +144,7 @@
- 
- # Include directories
- INCDIR_linux=-I. -I/usr/include/openssl
--INCDIR_freebsd=-I. -I/opt/openssl/include
-+INCDIR_freebsd=-I. -I/usr/local/include
- INCDIR_hpux=-I. -I/usr/local/include -I/opt/openssl/include
- INCDIR_tru64=-I. -I/opt/openssl/include
- INCDIR_SunOS=-I. -I/usr/local/ssl/include/
 @@ -154,8 +152,6 @@
  INCDIR_Darwin=-I. -I/usr/local/ssl/include
  INCDIR=$(INCDIR_$(SYSTEM)) 
@@ -81,3 +63,4 @@
  # Building without TLS and authentication (no openssl pre-requisite)
  all:
  	make OSNAME=`uname|sed -e "s/CYGWIN.*/CYGWIN/"` MODELNAME=`uname -m|sed "s/Power Macintosh/ppc/"` $(OUTPUT)
+
Index: files/patch-prepare_pcap.c
===================================================================
RCS file: /usr/cvs/ports/net/sipp/files/patch-prepare_pcap.c,v
retrieving revision 1.1
diff -u -3 -r1.1 patch-prepare_pcap.c
--- files/patch-prepare_pcap.c	21 Dec 2006 23:07:44 -0000	1.1
+++ files/patch-prepare_pcap.c	12 Nov 2007 12:55:38 -0000
@@ -1,48 +0,0 @@
-$FreeBSD: ports/net/sipp/files/patch-prepare_pcap.c,v 1.1 2006/12/21 23:07:44 miwi Exp $
-
---- prepare_pcap.c.orig
-+++ prepare_pcap.c
-@@ -19,7 +19,7 @@
- #include <stdlib.h>
- #include <netinet/in.h>
- #include <netinet/udp.h>
--#if defined(__HPUX) || defined(__CYGWIN)
-+#if defined(__HPUX) || defined(__CYGWIN) || defined(__FreeBSD__)
- #include <netinet/in_systm.h>
- #endif
- #include <netinet/ip.h>
-@@ -142,7 +142,7 @@
-         fprintf(stderr, "prepare_pcap.c: Ignoring non UDP packet!\n");
-         continue;
-       }
--#if defined(__DARWIN) || defined(__CYGWIN)
-+#if defined(__DARWIN) || defined(__CYGWIN) || defined(__FreeBSD__)
-       udphdr = (struct udphdr *)((char *)iphdr + (iphdr->ihl << 2) + 4);
-       pktlen = (u_long)(ntohs(udphdr->uh_ulen));
- #else
-@@ -164,7 +164,7 @@
-       ERROR("Can't allocate memory for pcap pkt data");
-     memcpy(pkt_index->data, udphdr, pktlen);
- 
--#if defined(__HPUX) || defined(__DARWIN) || (defined __CYGWIN)
-+#if defined(__HPUX) || defined(__DARWIN) || (defined __CYGWIN) || defined(__FreeBSD__)
-     udphdr->uh_sum = 0 ;      
- #else
-     udphdr->check = 0;
-@@ -173,14 +173,14 @@
-       // compute a partial udp checksum
-       // not including port that will be changed
-       // when sending RTP
--#if defined(__HPUX) || defined(__DARWIN) || (defined __CYGWIN)
-+#if defined(__HPUX) || defined(__DARWIN) || (defined __CYGWIN) || defined(__FreeBSD__)
-     pkt_index->partial_check = check((u_int16_t *) &udphdr->uh_ulen, pktlen - 4) + ntohs(IPPROTO_UDP + pktlen);
- #else
-     pkt_index->partial_check = check((u_int16_t *) &udphdr->len, pktlen - 4) + ntohs(IPPROTO_UDP + pktlen);
- #endif
-     if (max_length < pktlen)
-       max_length = pktlen;
--#if defined(__HPUX) || defined(__DARWIN) || (defined __CYGWIN)
-+#if defined(__HPUX) || defined(__DARWIN) || (defined __CYGWIN) || defined(__FreeBSD__)
-     if (base > ntohs(udphdr->uh_dport))
-       base = ntohs(udphdr->uh_dport);
- #else
Index: files/patch-prepare_pcap.h
===================================================================
RCS file: /usr/cvs/ports/net/sipp/files/patch-prepare_pcap.h,v
retrieving revision 1.1
diff -u -3 -r1.1 patch-prepare_pcap.h
--- files/patch-prepare_pcap.h	21 Dec 2006 23:07:44 -0000	1.1
+++ files/patch-prepare_pcap.h	12 Nov 2007 12:55:39 -0000
@@ -1,13 +0,0 @@
-$FreeBSD: ports/net/sipp/files/patch-prepare_pcap.h,v 1.1 2006/12/21 23:07:44 miwi Exp $
-
---- prepare_pcap.h.orig
-+++ prepare_pcap.h
-@@ -22,7 +22,7 @@
- #include <netinet/udp.h>
- #include <time.h>
- 
--#if defined(__HPUX) || defined(__DARWIN) || defined(__CYGWIN)
-+#if defined(__HPUX) || defined(__DARWIN) || defined(__CYGWIN) || defined(__FreeBSD__)
- #define u_int8_t uint8_t
- #define u_int16_t uint16_t
- #define u_int32_t uint32_t
Index: files/patch-send_packets.c
===================================================================
RCS file: /usr/cvs/ports/net/sipp/files/patch-send_packets.c,v
retrieving revision 1.1
diff -u -3 -r1.1 patch-send_packets.c
--- files/patch-send_packets.c	21 Dec 2006 23:07:44 -0000	1.1
+++ files/patch-send_packets.c	12 Nov 2007 12:55:45 -0000
@@ -1,13 +0,0 @@
-$FreeBSD: ports/net/sipp/files/patch-send_packets.c,v 1.1 2006/12/21 23:07:44 miwi Exp $
-
---- send_packets.c.orig
-+++ send_packets.c
-@@ -45,7 +45,7 @@
- #include <unistd.h>
- #include <stdlib.h>
- #include <netinet/udp.h>
--#if defined(__DARWIN) || defined(__CYGWIN)
-+#if defined(__DARWIN) || defined(__CYGWIN) || defined(__FreeBSD__)
- #include <netinet/in.h>
- #endif
- #ifndef __CYGWIN
--- /dev/null	2007-11-29 13:22:00.000000000 +0100
+++ files/patch-infile.cpp	2007-11-29 12:58:52.943888156 +0100
@@ -0,0 +1,17 @@
+--- infile.cpp~	2007-10-06 19:53:04.000000000 +0200
++++ infile.cpp	2007-11-29 12:58:45.100031747 +0100
+@@ -145,11 +145,13 @@
+ 	return ret;
+       }
+     case InputFileUser:
+-      if (userId == 0) {
++      if (userId <= 0) {
++	ERROR_P2("Illegal user %d was requested from file %s.", userId, fileName);
+ 	return -1;
+       }
+       if ((userId  - 1) >= numLinesInFile) {
+ 	ERROR_P3("%s has only %d lines, yet user %d was requested.", fileName, numLinesInFile, userId);
++	return -1;
+       }
+       return userId - 1;
+     default:
--- /dev/null	2007-11-29 13:22:00.000000000 +0100
+++ files/patch-message.cpp	2007-11-29 13:01:13.337258821 +0100
@@ -0,0 +1,25 @@
+--- message.cpp~	2007-10-29 15:53:20.000000000 +0100
++++ message.cpp	2007-11-28 15:58:41.346676624 +0100
+@@ -294,6 +294,8 @@
+ 	ERROR_P1("You can not use a keyword for the METHOD or to generate \"SIP/2.0\" to ensure proper [cseq] operation!\n%s\n", osrc);
+     }
+ 
++    // Avoid memory leak caused by following assignment if method != NULL
++    free(method);
+     char *p = method = strdup(getComponent(0)->literal);
+     char *q;
+     while (isspace(*p)) {
+@@ -318,10 +320,10 @@
+ 	method = NULL;
+     } else {
+       if (p != method) {
+-	memmove(method, p, strlen(p));
++	memmove(method, p, strlen(p) +1);
++//	method = (char *)realloc(method, strlen(method) +1);
++//	if (!method) { ERROR("Out of memory"); }
+       }
+-      method = (char *)realloc(method, strlen(method));
+-      if (!method) { ERROR("Out of memory"); }
+       ack = (!strcmp(method, "ACK"));
+       cancel = (!strcmp(method, "CANCEL"));
+       response = false;
>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20071129124203.DE4A18BF>