]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Check that ASN extracted from DNS record is numeris
authorAnton Yuzhaninov <citrin+github@citrin.ru>
Mon, 24 Jun 2019 11:13:31 +0000 (12:13 +0100)
committerAnton Yuzhaninov <citrin+github@citrin.ru>
Mon, 24 Jun 2019 12:34:07 +0000 (13:34 +0100)
src/plugins/lua/asn.lua

index 5adc2bd7f418789010b057bf2b447220b2b3190b..7f236ca99cc15e04c662550d93d39e4424ccc70d 100644 (file)
@@ -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)