[svn-commits] mmichelson: tag 1.6.0.25 r248847 - /tags/1.6.0.25/main/acl.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu Feb 25 13:40:59 CST 2010


Author: mmichelson
Date: Thu Feb 25 13:40:55 2010
New Revision: 248847

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=248847
Log:
Fix error where "/0" CIDR notation could be unpredictable.

AST-2010-003


Modified:
    tags/1.6.0.25/main/acl.c

Modified: tags/1.6.0.25/main/acl.c
URL: http://svnview.digium.com/svn/asterisk/tags/1.6.0.25/main/acl.c?view=diff&rev=248847&r1=248846&r2=248847
==============================================================================
--- tags/1.6.0.25/main/acl.c (original)
+++ tags/1.6.0.25/main/acl.c Thu Feb 25 13:40:55 2010
@@ -292,7 +292,14 @@
 
 		if (!strchr(nm, '.')) {
 			if ((sscanf(nm, "%30d", &x) == 1) && (x >= 0) && (x <= 32))
-				ha->netmask.s_addr = htonl(0xFFFFFFFF << (32 - x));
+				if (x == 0) {
+					/* This is special-cased to prevent unpredictable
+					 * behavior of shifting left 32 bits
+					 */
+					ha->netmask.s_addr = 0;
+				} else {
+					ha->netmask.s_addr = htonl(0xFFFFFFFF << (32 - x));
+				}
 			else {
 				ast_log(LOG_WARNING, "Invalid CIDR in %s\n", stuff);
 				ast_free(ha);




More information about the svn-commits mailing list