diff options
author | mmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b> | 2010-02-25 22:42:53 +0000 |
---|---|---|
committer | mmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b> | 2010-02-25 22:42:53 +0000 |
commit | 42d3284381e44e3976522bb8c694326d5c692bb7 (patch) | |
tree | 5f62a78bd2494954693aec509882c7a639218f23 /main/acl.c | |
parent | f2e5c69b405a70f316e678c90e674f80fb272a0e (diff) |
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: http://svn.digium.com/svn/asterisk/branches/1.6.2@248949 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main/acl.c')
-rw-r--r-- | main/acl.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/main/acl.c b/main/acl.c index 5ee6ef0fb..6a473ee9b 100644 --- a/main/acl.c +++ b/main/acl.c @@ -298,7 +298,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); |