mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-21 09:10:36 +00:00
various files - fix some alerts raised by lgtm code analysis
This patch fixes several issues reported by the lgtm code analysis tool: https://lgtm.com/projects/g/asterisk/asterisk Not all reported issues were addressed in this patch. This patch mostly fixes confirmed reported errors, potential problematic code points, and a few other "low hanging" warnings or recommendations found in core supported modules. These include, but are not limited to the following: * innapropriate stack allocation in loops * buffer overflows * variable declaration "hiding" another variable declaration * comparisons results that are always the same * ambiguously signed bit-field members * missing header guards Change-Id: Id4a881686605d26c94ab5409bc70fcc21efacc25
This commit is contained in:
committed by
George Joseph
parent
990a91b44a
commit
bdd785d31c
@@ -551,20 +551,24 @@ static int match_to_str(const void *obj, const intptr_t *args, char **buf)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int match_to_var_list(const void *obj, struct ast_variable **fields)
|
||||
static void match_to_var_list_append(struct ast_variable **head, struct ast_ha *ha)
|
||||
{
|
||||
char str[MAX_OBJECT_FIELD];
|
||||
const char *addr = ast_strdupa(ast_sockaddr_stringify_addr(&ha->addr));
|
||||
snprintf(str, MAX_OBJECT_FIELD, "%s%s/%s", ha->sense == AST_SENSE_ALLOW ? "!" : "",
|
||||
addr, ast_sockaddr_stringify_addr(&ha->netmask));
|
||||
|
||||
ast_variable_list_append(head, ast_variable_new("match", str, ""));
|
||||
}
|
||||
|
||||
static int match_to_var_list(const void *obj, struct ast_variable **fields)
|
||||
{
|
||||
const struct ip_identify_match *identify = obj;
|
||||
struct ast_variable *head = NULL;
|
||||
struct ast_ha *ha = identify->matches;
|
||||
|
||||
for (; ha; ha = ha->next) {
|
||||
const char *addr = ast_strdupa(ast_sockaddr_stringify_addr(&ha->addr));
|
||||
snprintf(str, MAX_OBJECT_FIELD, "%s%s/%s", ha->sense == AST_SENSE_ALLOW ? "!" : "",
|
||||
addr, ast_sockaddr_stringify_addr(&ha->netmask));
|
||||
|
||||
ast_variable_list_append(&head, ast_variable_new("match", str, ""));
|
||||
|
||||
match_to_var_list_append(&head, ha);
|
||||
}
|
||||
|
||||
if (head) {
|
||||
|
||||
Reference in New Issue
Block a user