diff options
author | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2010-11-16 22:00:29 +0300 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2010-11-16 22:00:29 +0300 |
commit | 3ebceeece2204d3755df1f1cc8210f7e97b6daad (patch) | |
tree | 38c122341dbbb2f1ea1a4c969ad95dda38c1106e /src/cfg_xml.c | |
parent | c85dd608a568d61e3b24c55b715ad37ceedb7110 (diff) | |
download | rspamd-3ebceeece2204d3755df1f1cc8210f7e97b6daad.tar.gz rspamd-3ebceeece2204d3755df1f1cc8210f7e97b6daad.zip |
Make own strlcpy that does not calculate remaining string length (faster and more safe)
Allow only ASCII symbols in logs, escape control chars
Diffstat (limited to 'src/cfg_xml.c')
-rw-r--r-- | src/cfg_xml.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/cfg_xml.c b/src/cfg_xml.c index 2e762ba1e..67523c845 100644 --- a/src/cfg_xml.c +++ b/src/cfg_xml.c @@ -456,7 +456,7 @@ xml_asciiz_string (memory_pool_t *pool, const gchar *text, gsize len) gchar *val; val = memory_pool_alloc (pool, len + 1); - g_strlcpy (val, text, len + 1); + rspamd_strlcpy (val, text, len + 1); return val; } @@ -1336,7 +1336,7 @@ rspamd_xml_start_element (GMarkupParseContext *context, const gchar *element_nam ud->section_pointer = check_worker_conf (ud->cfg, NULL); } else if (g_ascii_strcasecmp (element_name, "lua") == 0) { - g_strlcpy (ud->section_name, element_name, sizeof (ud->section_name)); + rspamd_strlcpy (ud->section_name, element_name, sizeof (ud->section_name)); ud->cur_attrs = process_attrs (ud->cfg, attribute_names, attribute_values); if (! handle_lua (ud->cfg, ud, ud->cur_attrs, NULL, NULL, ud->cfg, 0)) { *error = g_error_new (xml_error_quark (), XML_EXTRA_ELEMENT, "cannot parse tag '%s'", ud->section_name); @@ -1353,7 +1353,7 @@ rspamd_xml_start_element (GMarkupParseContext *context, const gchar *element_nam } else { /* Extract other tags */ - g_strlcpy (ud->section_name, element_name, sizeof (ud->section_name)); + rspamd_strlcpy (ud->section_name, element_name, sizeof (ud->section_name)); ud->cur_attrs = process_attrs (ud->cfg, attribute_names, attribute_values); ud->state = XML_READ_VALUE; } @@ -1367,7 +1367,7 @@ rspamd_xml_start_element (GMarkupParseContext *context, const gchar *element_nam ud->section_pointer = memory_pool_alloc0 (ud->cfg->cfg_pool, sizeof (struct statfile)); } else { - g_strlcpy (ud->section_name, element_name, sizeof (ud->section_name)); + rspamd_strlcpy (ud->section_name, element_name, sizeof (ud->section_name)); /* Save attributes */ ud->cur_attrs = process_attrs (ud->cfg, attribute_names, attribute_values); } @@ -1379,7 +1379,7 @@ rspamd_xml_start_element (GMarkupParseContext *context, const gchar *element_nam case XML_READ_WORKER: case XML_READ_LOGGING: case XML_READ_VIEW: - g_strlcpy (ud->section_name, element_name, sizeof (ud->section_name)); + rspamd_strlcpy (ud->section_name, element_name, sizeof (ud->section_name)); /* Save attributes */ ud->cur_attrs = process_attrs (ud->cfg, attribute_names, attribute_values); break; |