[asterisk-commits] seanbright: branch 1.6.0 r152062 - in /branches/1.6.0: ./ funcs/func_strings.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sun Oct 26 15:26:19 CDT 2008


Author: seanbright
Date: Sun Oct 26 15:26:18 2008
New Revision: 152062

URL: http://svn.digium.com/view/asterisk?view=rev&rev=152062
Log:
Merged revisions 152060 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

................
r152060 | seanbright | 2008-10-26 16:25:08 -0400 (Sun, 26 Oct 2008) | 15 lines

Merged revisions 152059 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r152059 | seanbright | 2008-10-26 16:23:36 -0400 (Sun, 26 Oct 2008) | 7 lines

Since passing \0 as the second argument to strchr is valid (and will
match the trailing \0 of a string) we need to check that first, otherwise
we end up with incorrect results.  Fix suggested by reporter.

(closes issue #13787)
Reported by: meitinger

........

................

Modified:
    branches/1.6.0/   (props changed)
    branches/1.6.0/funcs/func_strings.c

Propchange: branches/1.6.0/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.

Modified: branches/1.6.0/funcs/func_strings.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/funcs/func_strings.c?view=diff&rev=152062&r1=152061&r2=152062
==============================================================================
--- branches/1.6.0/funcs/func_strings.c (original)
+++ branches/1.6.0/funcs/func_strings.c Sun Oct 26 15:26:18 2008
@@ -778,7 +778,10 @@
 	char *bufptr, *dataptr;
 
 	for (bufptr = buf, dataptr = data; bufptr < buf + len - 1; dataptr++) {
-		if (*dataptr == '1') {
+		if (*dataptr == '\0') {
+			*bufptr++ = '\0';
+			break;
+		} else if (*dataptr == '1') {
 			*bufptr++ = '1';
 		} else if (strchr("AaBbCc2", *dataptr)) {
 			*bufptr++ = '2';
@@ -798,9 +801,6 @@
 			*bufptr++ = '9';
 		} else if (*dataptr == '0') {
 			*bufptr++ = '0';
-		} else if (*dataptr == '\0') {
-			*bufptr++ = '\0';
-			break;
 		}
 	}
 	buf[len - 1] = '\0';




More information about the asterisk-commits mailing list