[svn-commits] mmichelson: branch 1.6.2 r248949 - in /branches/1.6.2: ./ main/acl.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu Feb 25 16:42:56 CST 2010


Author: mmichelson
Date: Thu Feb 25 16:42:53 2010
New Revision: 248949

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

........
  r248946 | mmichelson | 2010-02-25 16:41:48 -0600 (Thu, 25 Feb 2010) | 5 lines
  
  Fix incorrect ACL behavior when CIDR notation of "/0" is used.
  
  AST-2010-003
........

Modified:
    branches/1.6.2/   (props changed)
    branches/1.6.2/main/acl.c

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

Modified: branches/1.6.2/main/acl.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.6.2/main/acl.c?view=diff&rev=248949&r1=248948&r2=248949
==============================================================================
--- branches/1.6.2/main/acl.c (original)
+++ branches/1.6.2/main/acl.c Thu Feb 25 16:42:53 2010
@@ -298,7 +298,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