From: Anton Yuzhaninov Date: Mon, 24 Jun 2019 11:13:31 +0000 (+0100) Subject: [Minor] Check that ASN extracted from DNS record is numeris X-Git-Tag: 2.0~727^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4977a84b1835cd67ed2a909fd91b52375ec2fb53;p=thirdparty%2Frspamd.git [Minor] Check that ASN extracted from DNS record is numeris --- diff --git a/src/plugins/lua/asn.lua b/src/plugins/lua/asn.lua index 5adc2bd7f4..7f236ca99c 100644 --- a/src/plugins/lua/asn.lua +++ b/src/plugins/lua/asn.lua @@ -42,8 +42,12 @@ local function asn_check(task) local descr_t = {} local mempool = task:get_mempool() if asn then - mempool:set_variable("asn", asn) - table.insert(descr_t, "asn:" .. asn) + if tonumber(asn) ~= nil then + mempool:set_variable("asn", asn) + table.insert(descr_t, "asn:" .. asn) + else + rspamd_logger.errx(task, 'malformed ASN "%s" for ip %s', asn, task:get_from_ip()) + end end if ipnet then mempool:set_variable("ipnet", ipnet)