From: Mark Michelson Date: Thu, 25 Feb 2010 22:42:35 +0000 (+0000) Subject: Merged revisions 248946 via svnmerge from X-Git-Tag: 1.6.1.18-rc1~24 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a25b72166500fa7d4b5b4ead9edf66f8209ff6ef;p=thirdparty%2Fasterisk.git 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 ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.6.1@248948 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/main/acl.c b/main/acl.c index 7a431036e7..2d70c63b34 100644 --- a/main/acl.c +++ b/main/acl.c @@ -292,7 +292,14 @@ struct ast_ha *ast_append_ha(const char *sense, const char *stuff, struct ast_ha 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);