[asterisk-commits] tilghman: trunk r221777 - in /trunk: ./ main/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Oct 1 18:59:18 CDT 2009


Author: tilghman
Date: Thu Oct  1 18:59:15 2009
New Revision: 221777

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=221777
Log:
Merged revisions 221776 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r221776 | tilghman | 2009-10-01 18:53:12 -0500 (Thu, 01 Oct 2009) | 2 lines
  
  Fix a bunch of off-by-one errors
........

Modified:
    trunk/   (props changed)
    trunk/main/asterisk.c
    trunk/main/rtp_engine.c
    trunk/main/say.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Modified: trunk/main/asterisk.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/asterisk.c?view=diff&rev=221777&r1=221776&r2=221777
==============================================================================
--- trunk/main/asterisk.c (original)
+++ trunk/main/asterisk.c Thu Oct  1 18:59:15 2009
@@ -1218,7 +1218,7 @@
 			continue;
 		}
 		if (fds[0].revents) {
-			res = read_credentials(con->fd, tmp, sizeof(tmp), con);
+			res = read_credentials(con->fd, tmp, sizeof(tmp) - 1, con);
 			if (res < 1) {
 				break;
 			}
@@ -2418,7 +2418,7 @@
 	if (ast_opt_remote) {
 		snprintf(buf, sizeof(buf), "_COMMAND NUMMATCHES \"%s\" \"%s\"", lf->buffer, ptr); 
 		fdsend(ast_consock, buf);
-		res = read(ast_consock, buf, sizeof(buf));
+		res = read(ast_consock, buf, sizeof(buf) - 1);
 		buf[res] = '\0';
 		nummatches = atoi(buf);
 

Modified: trunk/main/rtp_engine.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/rtp_engine.c?view=diff&rev=221777&r1=221776&r2=221777
==============================================================================
--- trunk/main/rtp_engine.c (original)
+++ trunk/main/rtp_engine.c Thu Oct  1 18:59:15 2009
@@ -499,7 +499,7 @@
 
 void ast_rtp_codecs_payloads_set_m_type(struct ast_rtp_codecs *codecs, struct ast_rtp_instance *instance, int payload)
 {
-	if (payload < 0 || payload > AST_RTP_MAX_PT || !static_RTP_PT[payload].code) {
+	if (payload < 0 || payload >= AST_RTP_MAX_PT || !static_RTP_PT[payload].code) {
 		return;
 	}
 
@@ -521,7 +521,7 @@
 	unsigned int i;
 	int found = 0;
 
-	if (pt < 0 || pt > AST_RTP_MAX_PT)
+	if (pt < 0 || pt >= AST_RTP_MAX_PT)
 		return -1; /* bogus payload type */
 
 	for (i = 0; i < ARRAY_LEN(ast_rtp_mime_types); ++i) {
@@ -569,7 +569,7 @@
 
 void ast_rtp_codecs_payloads_unset(struct ast_rtp_codecs *codecs, struct ast_rtp_instance *instance, int payload)
 {
-	if (payload < 0 || payload > AST_RTP_MAX_PT) {
+	if (payload < 0 || payload >= AST_RTP_MAX_PT) {
 		return;
 	}
 
@@ -587,7 +587,7 @@
 {
 	struct ast_rtp_payload_type result = { .asterisk_format = 0, };
 
-	if (payload < 0 || payload > AST_RTP_MAX_PT) {
+	if (payload < 0 || payload >= AST_RTP_MAX_PT) {
 		return result;
 	}
 

Modified: trunk/main/say.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/say.c?view=diff&rev=221777&r1=221776&r2=221777
==============================================================================
--- trunk/main/say.c (original)
+++ trunk/main/say.c Thu Oct  1 18:59:15 2009
@@ -3560,7 +3560,7 @@
 			case '\'':
 				/* Literal name of a sound file */
 				sndoffset=0;
-				for (sndoffset=0 ; (format[++offset] != '\'') && (sndoffset < 256) ; sndoffset++)
+				for (sndoffset=0 ; (format[++offset] != '\'') && (sndoffset < sizeof(sndfile) - 1) ; sndoffset++)
 					sndfile[sndoffset] = format[offset];
 				sndfile[sndoffset] = '\0';
 				res = wait_file(chan, ints, sndfile, lang);
@@ -3807,7 +3807,7 @@
 			case '\'':
 				/* Literal name of a sound file */
 				sndoffset=0;
-				for (sndoffset=0 ; (format[++offset] != '\'') && (sndoffset < 256) ; sndoffset++)
+				for (sndoffset=0 ; (format[++offset] != '\'') && (sndoffset < sizeof(sndfile) - 1) ; sndoffset++)
 					sndfile[sndoffset] = format[offset];
 				sndfile[sndoffset] = '\0';
 				res = wait_file(chan, ints, sndfile, lang);
@@ -4009,7 +4009,7 @@
 			case '\'':
 				/* Literal name of a sound file */
 				sndoffset=0;
-				for (sndoffset=0 ; (format[++offset] != '\'') && (sndoffset < 256) ; sndoffset++)
+				for (sndoffset=0 ; (format[++offset] != '\'') && (sndoffset < sizeof(sndfile) - 1) ; sndoffset++)
 					sndfile[sndoffset] = format[offset];
 				sndfile[sndoffset] = '\0';
 				res = wait_file(chan, ints, sndfile, lang);
@@ -4406,7 +4406,7 @@
 			case '\'':
 				/* Literal name of a sound file */
 				sndoffset=0;
-				for (sndoffset=0 ; (format[++offset] != '\'') && (sndoffset < 256) ; sndoffset++)
+				for (sndoffset=0 ; (format[++offset] != '\'') && (sndoffset < sizeof(sndfile) - 1) ; sndoffset++)
 					sndfile[sndoffset] = format[offset];
 				sndfile[sndoffset] = '\0';
 				res = wait_file(chan, ints, sndfile, lang);
@@ -4546,7 +4546,7 @@
 			case '\'':
 				/* Literal name of a sound file */
 				sndoffset=0;
-				for (sndoffset=0 ; (format[++offset] != '\'') && (sndoffset < 256) ; sndoffset++)
+				for (sndoffset=0 ; (format[++offset] != '\'') && (sndoffset < sizeof(sndfile) - 1) ; sndoffset++)
 					sndfile[sndoffset] = format[offset];
 				sndfile[sndoffset] = '\0';
 				snprintf(nextmsg, sizeof(nextmsg), "%s", sndfile);
@@ -4735,7 +4735,7 @@
 			case '\'':
 				/* Literal name of a sound file */
 				sndoffset=0;
-				for (sndoffset=0 ; (format[++offset] != '\'') && (sndoffset < 256) ; sndoffset++)
+				for (sndoffset=0 ; (format[++offset] != '\'') && (sndoffset < sizeof(sndfile) - 1) ; sndoffset++)
 					sndfile[sndoffset] = format[offset];
 				sndfile[sndoffset] = '\0';
 				res = wait_file(chan, ints, sndfile, lang);
@@ -4930,7 +4930,7 @@
 			case '\'':
 				/* Literal name of a sound file */
 				sndoffset=0;
-				for (sndoffset=0 ; (format[++offset] != '\'') && (sndoffset < 256) ; sndoffset++)
+				for (sndoffset=0 ; (format[++offset] != '\'') && (sndoffset < sizeof(sndfile) - 1) ; sndoffset++)
 					sndfile[sndoffset] = format[offset];
 				sndfile[sndoffset] = '\0';
 				res = wait_file(chan, ints, sndfile, lang);
@@ -5160,7 +5160,7 @@
 			case '\'':
 				/* Literal name of a sound file */
 				sndoffset=0;
-				for (sndoffset=0 ; (format[++offset] != '\'') && (sndoffset < 256) ; sndoffset++)
+				for (sndoffset=0 ; (format[++offset] != '\'') && (sndoffset < sizeof(sndfile) - 1) ; sndoffset++)
 					sndfile[sndoffset] = format[offset];
 				sndfile[sndoffset] = '\0';
 				res = wait_file(chan, ints, sndfile, lang);
@@ -5363,7 +5363,7 @@
 			case '\'':
 				/* Literal name of a sound file */
 				sndoffset = 0;
-				for (sndoffset = 0 ; (format[++offset] != '\'') && (sndoffset < 256) ; sndoffset++)
+				for (sndoffset = 0 ; (format[++offset] != '\'') && (sndoffset < sizeof(sndfile) - 1) ; sndoffset++)
 					sndfile[sndoffset] = format[offset];
 				sndfile[sndoffset] = '\0';
 				res = wait_file(chan, ints, sndfile, lang);
@@ -5582,7 +5582,7 @@
 			case '\'':
 				/* Literal name of a sound file */
 				sndoffset=0;
-				for (sndoffset=0 ; (format[++offset] != '\'') && (sndoffset < 256) ; sndoffset++)
+				for (sndoffset=0 ; (format[++offset] != '\'') && (sndoffset < sizeof(sndfile) - 1) ; sndoffset++)
 					sndfile[sndoffset] = format[offset];
 				sndfile[sndoffset] = '\0';
 				snprintf(nextmsg, sizeof(nextmsg), "%s", sndfile);
@@ -5874,7 +5874,7 @@
 			case '\'':
 				/* Literal name of a sound file */
 				sndoffset=0;
-				for (sndoffset=0 ; (format[++offset] != '\'') && (sndoffset < 256) ; sndoffset++)
+				for (sndoffset=0 ; (format[++offset] != '\'') && (sndoffset < sizeof(sndfile) - 1) ; sndoffset++)
 					sndfile[sndoffset] = format[offset];
 				sndfile[sndoffset] = '\0';
 				res = wait_file(chan, ints, sndfile, lang);
@@ -7363,7 +7363,7 @@
 		case '\'':
 			/* Literal name of a sound file */
 			sndoffset=0;
-			for (sndoffset=0 ; (format[++offset] != '\'') && (sndoffset < 256) ; sndoffset++)
+			for (sndoffset=0 ; (format[++offset] != '\'') && (sndoffset < sizeof(sndfile) - 1) ; sndoffset++)
 				sndfile[sndoffset] = format[offset];
 			sndfile[sndoffset] = '\0';
 			res = wait_file(chan, ints, sndfile, lang);




More information about the asterisk-commits mailing list