diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-10-29 08:48:03 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-10-29 08:48:03 +0000 |
commit | 6ad1b2e5d258fece916f01a50f6d89e39b701143 (patch) | |
tree | f9ade34a63ad38dad588be38b2f2595b3f3266bc /src/lua | |
parent | b7c045e483cb9cf069a605d8054d937080863553 (diff) | |
download | rspamd-6ad1b2e5d258fece916f01a50f6d89e39b701143.tar.gz rspamd-6ad1b2e5d258fece916f01a50f6d89e39b701143.zip |
Fix another issue with fixed strings.
Diffstat (limited to 'src/lua')
-rw-r--r-- | src/lua/lua_http.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/lua/lua_http.c b/src/lua/lua_http.c index b7b63596e..c6c95c9df 100644 --- a/src/lua/lua_http.c +++ b/src/lua/lua_http.c @@ -273,6 +273,7 @@ static gint lua_http_request (lua_State *L) { const gchar *url, *lua_body; + gchar *to_resolve; gint cbref; gsize bodylen; struct event_base *ev_base; @@ -460,17 +461,25 @@ lua_http_request (lua_State *L) } else { if (task == NULL) { + to_resolve = g_malloc (msg->host->len + 1); + rspamd_strlcpy (to_resolve, msg->host->str, msg->host->len + 1); + if (!make_dns_request (resolver, session, NULL, lua_http_dns_handler, cbd, RDNS_REQUEST_A, msg->host->str)) { lua_http_maybe_free (cbd); lua_pushboolean (L, FALSE); + g_free (to_resolve); return 1; } + + g_free (to_resolve); } else { + to_resolve = rspamd_mempool_fstrdup (task->task_pool, msg->host); + if (!make_dns_request_task (task, lua_http_dns_handler, cbd, - RDNS_REQUEST_A, msg->host->str)) { + RDNS_REQUEST_A, to_resolve)) { lua_http_maybe_free (cbd); lua_pushboolean (L, FALSE); |