[asterisk-commits] simon.perreault: branch group/v6 r84633 - /team/group/v6/trunk/main/rtp.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Oct 4 07:52:49 CDT 2007


Author: simon.perreault
Date: Thu Oct  4 07:52:48 2007
New Revision: 84633

URL: http://svn.digium.com/view/asterisk?view=rev&rev=84633
Log:
Trying to make name lookup errors more recognizable. Also fixes reading off the end of the
buffer in case of an error.

Modified:
    team/group/v6/trunk/main/rtp.c

Modified: team/group/v6/trunk/main/rtp.c
URL: http://svn.digium.com/view/asterisk/team/group/v6/trunk/main/rtp.c?view=diff&rev=84633&r1=84632&r2=84633
==============================================================================
--- team/group/v6/trunk/main/rtp.c (original)
+++ team/group/v6/trunk/main/rtp.c Thu Oct  4 07:52:48 2007
@@ -795,10 +795,10 @@
 
 static struct ast_frame *send_dtmf(struct ast_rtp *rtp, enum ast_frame_type type)
 {
-	char hostport[NI_MAXHOST];
+	char hostport[NI_MAXHOST] = "<error>";
 
 	ast_vinetsock_sa_get_hostport((struct sockaddr*)&rtp->them,
-			rtp->themlen, hostport, sizeof(NI_MAXHOST));
+			rtp->themlen, hostport, sizeof(hostport));
 
 	if (((ast_test_flag(rtp, FLAG_DTMF_COMPENSATE) && type == AST_FRAME_DTMF_END) ||
 	     (type == AST_FRAME_DTMF_BEGIN)) && ast_tvcmp(ast_tvnow(), rtp->dtmfmute) < 0) {
@@ -1008,7 +1008,7 @@
 static struct ast_frame *process_rfc3389(struct ast_rtp *rtp, unsigned char *data, int len)
 {
 	struct ast_frame *f = NULL;
-	char iabuf[NI_MAXHOST];
+	char iabuf[NI_MAXHOST] = "<error>";
 
 	/* Convert comfort noise into audio with various codecs.  Unfortunately this doesn't
 	   totally help us out becuase we don't have an engine to keep it going and we are not
@@ -1078,7 +1078,7 @@
 	unsigned int lsw;
 	unsigned int comp;
 	struct ast_frame *f = &ast_null_frame;
-	char hostport[NI_MAXHOST];
+	char hostport[NI_MAXHOST] = "<error>";
 	
 	if (!rtp || !rtp->rtcp)
 		return &ast_null_frame;
@@ -1362,7 +1362,7 @@
 	int res = 0, payload = 0, bridged_payload = 0, mark;
 	struct rtpPayloadType rtpPT;
 	int reconstruct = ntohl(rtpheader[0]);
-	char hostport[NI_MAXHOST];
+	char hostport[NI_MAXHOST] = "<error>";
 
 	/* Get fields from packet */
 	payload = (reconstruct & 0x7f0000) >> 16;
@@ -1427,7 +1427,7 @@
 	unsigned int *rtpheader;
 	struct rtpPayloadType rtpPT;
 	struct ast_rtp *bridged = NULL;
-	char hostport[NI_MAXHOST];
+	char hostport[NI_MAXHOST] = "<error>";
 	
 	/* If time is up, kill it */
 	if (rtp->sending_digit)
@@ -2583,7 +2583,7 @@
 	unsigned int *rtpheader;
 	int hdrlen = 12, res = 0, i = 0, payload = 0;
 	char data[256];
-	char hostport[NI_MAXHOST];
+	char hostport[NI_MAXHOST] = "<error>";
 
 	if ((digit <= '9') && (digit >= '0'))
 		digit -= '0';
@@ -2650,7 +2650,7 @@
 	unsigned int *rtpheader;
 	int hdrlen = 12, res = 0;
 	char data[256];
-	char hostport[NI_MAXHOST];
+	char hostport[NI_MAXHOST] = "<error>";
 
 	if (!rtp->themlen)
 		return 0;
@@ -2689,7 +2689,7 @@
 	unsigned int *rtpheader;
 	int hdrlen = 12, res = 0, i = 0;
 	char data[256];
-	char hostport[NI_MAXHOST];
+	char hostport[NI_MAXHOST] = "<error>";
 	
 	/* If no address, then bail out */
 	if (!rtp->themlen)
@@ -2773,7 +2773,7 @@
 	int fraction;
 	struct timeval dlsr;
 	char bdata[512];
-	char hostport[NI_MAXHOST];
+	char hostport[NI_MAXHOST] = "<error>";
 
 	if (!rtp || !rtp->rtcp || !rtp->rtcp->themlen)
 		return 0;
@@ -2911,7 +2911,7 @@
 	char bdata[1024];
 	struct timeval dlsr;
 	int fraction;
-	char hostport[NI_MAXHOST];
+	char hostport[NI_MAXHOST] = "<error>";
 
 	if (!rtp || !rtp->rtcp || !rtp->rtcp->themlen)
 		return 0;
@@ -3021,7 +3021,7 @@
 	int res;
 	int payload;
 	char data[256];
-	char hostport[NI_MAXHOST];
+	char hostport[NI_MAXHOST] = "<error>";
 	level = 127 - (level & 0x7f);
 	payload = ast_rtp_lookup_code(rtp, 0, AST_RTP_CN);
 
@@ -3060,7 +3060,7 @@
 	unsigned int ms;
 	int pred;
 	int mark = 0;
-	char hostport[NI_MAXHOST];
+	char hostport[NI_MAXHOST] = "<error>";
 
 	ms = calc_txstamp(rtp, &f->delivery);
 	/* Default prediction */
@@ -3301,7 +3301,7 @@
 	socklen_t ac1len = 0, vac1len = 0, tac1len = 0, ac0len = 0, vac0len = 0,
 		  tac0len = 0, t1len = 0, vt1len = 0, tt1len = 0, t0len = 0,
 		  vt0len = 0, tt0len = 0;
-	char hostport[NI_MAXHOST];
+	char hostport[NI_MAXHOST] = "<error>";
 	
 	/* Set it up so audio goes directly between the two endpoints */
 
@@ -3934,8 +3934,8 @@
 
 static int rtp_do_debug_ip(int fd, int argc, char *argv[])
 {
-	char host[NI_MAXHOST];
-	char port[NI_MAXSERV];
+	char host[NI_MAXHOST] = "<error>";
+	char port[NI_MAXSERV] = "<error>";
 
 	if (argc != 4)
 		return RESULT_SHOWUSAGE;
@@ -3961,8 +3961,8 @@
 
 static int rtcp_do_debug_ip(int fd, int argc, char *argv[])
 {
-	char host[NI_MAXHOST];
-	char port[NI_MAXSERV];
+	char host[NI_MAXHOST] = "<error>";
+	char port[NI_MAXSERV] = "<error>";
 
 	if (argc != 5)
 		return RESULT_SHOWUSAGE;




More information about the asterisk-commits mailing list