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/map.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/map.c')
-rw-r--r-- | src/map.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -134,7 +134,7 @@ parse_http_reply (u_char * chunk, size_t len, struct http_reply *reply) case 2: if (*p == ':') { reply->cur_header = g_malloc (p - s + 1); - g_strlcpy (reply->cur_header, s, p - s + 1); + rspamd_strlcpy (reply->cur_header, s, p - s + 1); reply->parser_state = 3; } else if (*p == '\r' && *(p + 1) == '\n') { @@ -158,7 +158,7 @@ parse_http_reply (u_char * chunk, size_t len, struct http_reply *reply) if (*p == '\r') { if (reply->cur_header != NULL) { tmp = g_malloc (p - s + 1); - g_strlcpy (tmp, s, p - s + 1); + rspamd_strlcpy (tmp, s, p - s + 1); g_hash_table_insert (reply->headers, reply->cur_header, tmp); reply->cur_header = NULL; } @@ -476,7 +476,7 @@ add_map (const gchar *map_line, map_cb_t read_callback, map_fin_cb_t fin_callbac hostend = p; } hdata->host = memory_pool_alloc (map_pool, hostend - def + 1); - g_strlcpy (hdata->host, def, hostend - def + 1); + rspamd_strlcpy (hdata->host, def, hostend - def + 1); hdata->path = memory_pool_strdup (map_pool, p); hdata->rlen = 0; /* Now try to resolve */ |