/* Try to match regexp */
if (!re->is_raw) {
/* Validate input */
- if (!g_utf8_validate (cur->data, -1, NULL)) {
+ if (!cur->data || !g_utf8_validate (cur->data, -1, NULL)) {
cur = g_list_next (cur);
continue;
}
/* Try to match regexp */
if (!re->is_raw) {
/* Validate input */
- if (!g_utf8_validate (rh->value, -1, NULL)) {
+ if (!rh->value || !g_utf8_validate (rh->value, -1, NULL)) {
cur = g_list_next (cur);
continue;
}
}
cd->symbols_offset += rspamd_snprintf (cd->symbols_buf + cd->symbols_offset, cd->symbols_size - cd->symbols_offset,
" },");
+ cd->log_offset += rspamd_snprintf (cd->log_buf + cd->log_offset, cd->log_size - cd->log_offset,
+ "%s,", (gchar *)key);
}
/*
* Print a single symbol using json protocol
g_hash_table_foreach (h, metric_symbols_callback_json, cd);
g_hash_table_unref (h);
if (cd->alive) {
+ /* Remove last , from log buf */
+ if (cd->log_buf[cd->log_offset - 1] == ',') {
+ cd->log_buf[--cd->log_offset] = '\0';
+ }
/* Remove last ',' symbol */
if (cd->symbols_buf[cd->symbols_offset - 1] == ',') {
cd->symbols_buf[--cd->symbols_offset] = '\0';