]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Rdns: One more sanity check added
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 23 Aug 2021 13:10:01 +0000 (14:10 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 23 Aug 2021 13:10:01 +0000 (14:10 +0100)
contrib/librdns/parse.c

index 559d430a0ed09d9dae6bff2db8cfc4cb11eaa96a..18bb6a6946e11030ccf2663eddc1b5846a8e4209 100644 (file)
@@ -370,6 +370,16 @@ rdns_parse_rr (struct rdns_resolver *resolver,
                                        *remain -= txtlen + 1;
                                }
                                else {
+
+                                       if (txtlen + copied + parts > datalen) {
+                                               /* Incorrect datalen reported ! */
+                                               rdns_err ("incorrect txtlen (%d) > datalen (%d) reported; domain %s",
+                                                               (txtlen + copied + parts), datalen,
+                                                               rep->requested_name);
+                                               return -1;
+                                       }
+
+                                       /* Reported equal to the actual data copied */
                                        break;
                                }
                        }
@@ -425,7 +435,7 @@ rdns_parse_rr (struct rdns_resolver *resolver,
                *remain -= datalen;
                break;
        default:
-               rdns_debug ("unexpected RR type: %d; domain %s", type, rep->requested_name);
+               rdns_info ("unexpected RR type: %d; domain %s", type, rep->requested_name);
                p += datalen;
                *remain -= datalen;
                break;