diff options
author | seanbright <seanbright@f38db490-d61c-443f-a65b-d21fe96a405b> | 2011-01-28 20:19:08 +0000 |
---|---|---|
committer | seanbright <seanbright@f38db490-d61c-443f-a65b-d21fe96a405b> | 2011-01-28 20:19:08 +0000 |
commit | af14ec6df01a630d8bddf567cc97594bc3db7258 (patch) | |
tree | 41adb134ab2b2a2e84385bc93b2c1dcff8f84802 /main | |
parent | 6704b5cdcf95ab0802a3ec49cce9f12593c0dbba (diff) |
Restore some conditionals that we lost in r277814.
There are some cases where ast_append_ha() is called with a NULL instead of a
valid int pointer. So if we get a NULL, don't try to dereference it.
(closes issue #18162)
Reported by: imcdona
Patches:
issue0018162.patch uploaded by pabelanger (license 224)
Tested by: enegaard
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.8@304638 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main')
-rw-r--r-- | main/acl.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/main/acl.c b/main/acl.c index dcbc3a965..a7b283ed9 100644 --- a/main/acl.c +++ b/main/acl.c @@ -421,7 +421,9 @@ struct ast_ha *ast_append_ha(const char *sense, const char *stuff, struct ast_ha if (!ast_sockaddr_parse(&ha->addr, address, PARSE_PORT_FORBID)) { ast_log(LOG_WARNING, "Invalid IP address: %s\n", address); ast_free_ha(ha); - *error = 1; + if (error) { + *error = 1; + } return ret; } @@ -443,7 +445,9 @@ struct ast_ha *ast_append_ha(const char *sense, const char *stuff, struct ast_ha if (!ast_sockaddr_parse(&ha->netmask, mask, PARSE_PORT_FORBID)) { ast_log(LOG_WARNING, "Invalid netmask: %s\n", mask); ast_free_ha(ha); - *error = 1; + if (error) { + *error = 1; + } return ret; } /* If someone specifies an IPv4-mapped IPv6 netmask, @@ -457,13 +461,17 @@ struct ast_ha *ast_append_ha(const char *sense, const char *stuff, struct ast_ha if (addr_is_v4 ^ mask_is_v4) { ast_log(LOG_WARNING, "Address and mask are not using same address scheme.\n"); ast_free_ha(ha); - *error = 1; + if (error) { + *error = 1; + } return ret; } } else if (parse_cidr_mask(&ha->netmask, addr_is_v4, mask)) { ast_log(LOG_WARNING, "Invalid CIDR netmask: %s\n", mask); ast_free_ha(ha); - *error = 1; + if (error) { + *error = 1; + } return ret; } @@ -475,7 +483,9 @@ struct ast_ha *ast_append_ha(const char *sense, const char *stuff, struct ast_ha char *failaddr = ast_strdupa(ast_sockaddr_stringify(&ha->addr)); ast_log(LOG_WARNING, "Unable to apply netmask %s to address %s\n", failmask, failaddr); ast_free_ha(ha); - *error = 1; + if (error) { + *error = 1; + } return ret; } |