diff options
author | Petr Vaněk <arkamar@atlas.cz> | 2021-09-06 08:42:00 +0200 |
---|---|---|
committer | Sam James <sam@gentoo.org> | 2021-09-07 21:23:47 +0100 |
commit | 066a3f86023d2329d692558e9f869fc892071d96 (patch) | |
tree | 5e993baed190b6db016cff1c263c1e111d90dba9 /mail-filter | |
parent | dev-cpp/doctest: initial import (diff) | |
download | gentoo-066a3f86023d2329d692558e9f869fc892071d96.tar.gz gentoo-066a3f86023d2329d692558e9f869fc892071d96.tar.bz2 gentoo-066a3f86023d2329d692558e9f869fc892071d96.zip |
mail-filter/rspamd: backport null dereference fix
This Backports patch which fixes possible runtime segfaults caused by
null pointer dereference.
Signed-off-by: Petr Vaněk <arkamar@atlas.cz>
Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'mail-filter')
-rw-r--r-- | mail-filter/rspamd/files/rspamd-3.0-fix-null-dereference.patch | 46 | ||||
-rw-r--r-- | mail-filter/rspamd/rspamd-3.0-r2.ebuild | 1 |
2 files changed, 47 insertions, 0 deletions
diff --git a/mail-filter/rspamd/files/rspamd-3.0-fix-null-dereference.patch b/mail-filter/rspamd/files/rspamd-3.0-fix-null-dereference.patch new file mode 100644 index 000000000000..d355f701a273 --- /dev/null +++ b/mail-filter/rspamd/files/rspamd-3.0-fix-null-dereference.patch @@ -0,0 +1,46 @@ +From abea3ac21f764658a966dad475fc99e4b79530d7 Mon Sep 17 00:00:00 2001 +From: Jan Smutny <js@excello.cz> +Date: Tue, 31 Aug 2021 14:25:23 +0200 +Subject: [PATCH] [Fix] src/lua/lua_mimepart.c: fix null dereference + +--- + +This patch is taken from upstream. It fixes possible runtime segfaults. + +PR: https://github.com/rspamd/rspamd/pull/3873 + +diff --git a/src/lua/lua_mimepart.c b/src/lua/lua_mimepart.c +index 66b588e3a..21a46d496 100644 +--- a/src/lua/lua_mimepart.c ++++ b/src/lua/lua_mimepart.c +@@ -1240,7 +1240,16 @@ lua_textpart_get_fuzzy_hashes (lua_State * L) + rspamd_stat_token_t *word; + struct lua_shingle_filter_cbdata cbd; + +- if (part && pool) { ++ ++ if (part == NULL || pool == NULL) { ++ return luaL_error (L, "invalid arguments"); ++ } ++ ++ if (IS_TEXT_PART_EMPTY (part) || part->utf_words == NULL) { ++ lua_pushnil (L); ++ lua_pushnil (L); ++ } ++ else { + /* TODO: add keys and algorithms support */ + rspamd_cryptobox_hash (key, "rspamd", strlen ("rspamd"), NULL, 0); + +@@ -1294,9 +1303,6 @@ lua_textpart_get_fuzzy_hashes (lua_State * L) + } + } + } +- else { +- return luaL_error (L, "invalid arguments"); +- } + + return 2; + } +-- +2.31.1 + diff --git a/mail-filter/rspamd/rspamd-3.0-r2.ebuild b/mail-filter/rspamd/rspamd-3.0-r2.ebuild index efe18dc57b00..30065ff095b5 100644 --- a/mail-filter/rspamd/rspamd-3.0-r2.ebuild +++ b/mail-filter/rspamd/rspamd-3.0-r2.ebuild @@ -60,6 +60,7 @@ BDEPEND=" PATCHES=( "${FILESDIR}/${P}-cmake-lua-version.patch" "${FILESDIR}/${P}-system-libfmt.patch" + "${FILESDIR}/${P}-fix-null-dereference.patch" "${FILESDIR}/${PN}-2.6-unbundle-lua.patch" "${FILESDIR}/${PN}-2.5-unbundle-snowball.patch" ) |