加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
CVE-2018-20102.patch 1.24 KB
一键复制 编辑 原始数据 按行查看 历史
daidai_is_here 提交于 2020-02-14 10:50 . init package
From efbbdf72992cd20458259962346044cafd9331c0 Mon Sep 17 00:00:00 2001
From: Remi Gacogne <remi.gacogne@powerdns.com>
Date: Wed, 5 Dec 2018 17:56:29 +0100
Subject: [PATCH] BUG: dns: Prevent out-of-bounds read in
dns_validate_dns_response()
We need to make sure that the record length is not making us read
past the end of the data we received.
Before this patch we could for example read the 16 bytes
corresponding to an AAAA record from the non-initialized part of
the buffer, possibly accessing anything that was left on the stack,
or even past the end of the 8193-byte buffer, depending on the
value of accepted_payload_size.
To be backported to 1.8, probably also 1.7.
---
src/dns.c | 5 +++++
1 file changed, 5 insertions(+)
Index: haproxy-1.8.13/src/dns.c
===================================================================
--- haproxy-1.8.13.orig/src/dns.c
+++ haproxy-1.8.13/src/dns.c
@@ -798,6 +798,11 @@ static int dns_validate_dns_response(uns
/* Move forward 2 bytes for data len */
reader += 2;
+ if (reader + dns_answer_record->data_len >= bufend) {
+ pool_free(dns_answer_item_pool, dns_answer_record);
+ return DNS_RESP_INVALID;
+ }
+
/* Analyzing record content */
switch (dns_answer_record->type) {
case DNS_RTYPE_A:
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化