commit 295b806: [Minor] Add some fail safety

Vsevolod Stakhov vsevolod at highsecure.ru
Tue Jan 22 16:35:03 UTC 2019


Author: Vsevolod Stakhov
Date: 2019-01-22 16:32:52 +0000
URL: https://github.com/rspamd/rspamd/commit/295b806e92a75d06eae3b02a633a647bf28b8bec

[Minor] Add some fail safety

---
 src/plugins/dkim_check.c | 31 +++++++++++++++++++++++++++----
 1 file changed, 27 insertions(+), 4 deletions(-)

diff --git a/src/plugins/dkim_check.c b/src/plugins/dkim_check.c
index 83272a585..a203edc3d 100644
--- a/src/plugins/dkim_check.c
+++ b/src/plugins/dkim_check.c
@@ -1606,10 +1606,33 @@ dkim_module_lua_push_verify_result (struct rspamd_dkim_lua_verify_cbdata *cbd,
 	lua_pushstring (cbd->L, error_str);
 
 	if (cbd->ctx) {
-		lua_pushstring (cbd->L, res->domain);
-		lua_pushstring (cbd->L, res->selector);
-		lua_pushstring (cbd->L, res->short_b);
-		lua_pushstring (cbd->L, res->fail_reason);
+		if (res->domain) {
+			lua_pushstring (cbd->L, res->domain);
+		}
+		else {
+			lua_pushnil (cbd->L);
+		}
+
+		if (res->selector) {
+			lua_pushstring (cbd->L, res->selector);
+		}
+		else {
+			lua_pushnil (cbd->L);
+		}
+
+		if (res->short_b) {
+			lua_pushstring (cbd->L, res->short_b);
+		}
+		else {
+			lua_pushnil (cbd->L);
+		}
+
+		if (res->fail_reason) {
+			lua_pushstring (cbd->L, res->fail_reason);
+		}
+		else {
+			lua_pushnil (cbd->L);
+		}
 	}
 	else {
 		lua_pushnil (cbd->L);


More information about the Commits mailing list