]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Allow to pre-allocate lua_text
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 4 May 2020 16:38:58 +0000 (17:38 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 4 May 2020 17:07:18 +0000 (18:07 +0100)
src/lua/lua_text.c

index e23eed8cbb2dfe3400170a42b67fcec5524c57e8..2586b3302917dd3ea7be73bb35acfc8687b01769 100644 (file)
@@ -198,7 +198,11 @@ lua_new_text (lua_State *L, const gchar *start, gsize len, gboolean own)
 
                if (len > 0) {
                        storage = g_malloc (len);
-                       memcpy (storage, start, len);
+
+                       if (start != NULL) {
+                               memcpy (storage, start, len);
+                       }
+
                        t->start = storage;
                        t->flags = RSPAMD_TEXT_FLAG_OWN;
                }