mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-03-13 12:40:17 +00:00
mod_graylog2: additional input checks on LOG_FIELDS[]
This commit is contained in:
parent
0b6f10a6a8
commit
eae1c4477a
@ -123,6 +123,7 @@ static char *to_gelf(const switch_log_node_t *node, switch_log_level_t log_level
|
|||||||
|
|
||||||
switch_event_header_t *hp;
|
switch_event_header_t *hp;
|
||||||
for (hp = log_fields->headers; hp; hp = hp->next) {
|
for (hp = log_fields->headers; hp; hp = hp->next) {
|
||||||
|
if (!zstr(hp->name) && !zstr(hp->value)) {
|
||||||
if (strncmp(hp->name, "@#", 2) == 0) {
|
if (strncmp(hp->name, "@#", 2) == 0) {
|
||||||
field_name = switch_mprintf("_%s", hp->name + 2);
|
field_name = switch_mprintf("_%s", hp->name + 2);
|
||||||
cJSON_AddItemToObject(gelf, field_name, cJSON_CreateNumber(strtod(hp->value, NULL)));
|
cJSON_AddItemToObject(gelf, field_name, cJSON_CreateNumber(strtod(hp->value, NULL)));
|
||||||
@ -132,6 +133,7 @@ static char *to_gelf(const switch_log_node_t *node, switch_log_level_t log_level
|
|||||||
}
|
}
|
||||||
free(field_name);
|
free(field_name);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
switch_event_destroy(&log_fields);
|
switch_event_destroy(&log_fields);
|
||||||
full_message = parsed_full_message;
|
full_message = parsed_full_message;
|
||||||
@ -149,9 +151,7 @@ static char *to_gelf(const switch_log_node_t *node, switch_log_level_t log_level
|
|||||||
gelf_text = cJSON_PrintUnformatted(gelf);
|
gelf_text = cJSON_PrintUnformatted(gelf);
|
||||||
cJSON_Delete(gelf);
|
cJSON_Delete(gelf);
|
||||||
|
|
||||||
if (parsed_full_message != NULL) {
|
switch_safe_free(parsed_full_message);
|
||||||
free(parsed_full_message);
|
|
||||||
}
|
|
||||||
|
|
||||||
return gelf_text;
|
return gelf_text;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user