!4 Fix invalid read in ares_parse_soa_reply found by fuzz

Merge pull request !4 from ltx/openEuler-20.03-LTS
This commit is contained in:
openeuler-ci-bot 2020-05-29 18:01:38 +08:00 committed by Gitee
commit 8bc4d5c977
2 changed files with 33 additions and 1 deletions

View File

@ -0,0 +1,25 @@
commit 1b98172b141fe874ad43e679e67506f9b2139043
Author: lutianxiong <50396812+ltx2018@users.noreply.github.com>
Date: Fri May 22 20:02:21 2020 +0800
avoid read-heap-buffer-overflow (#332)
Fix invalid read in ares_parse_soa_reply.c found during fuzzing
Fixes Bug: #333
Fix By: lutianxiong (@ltx2018)
diff --git a/ares_parse_soa_reply.c b/ares_parse_soa_reply.c
index 2a2cac8..7cfaed2 100644
--- a/ares_parse_soa_reply.c
+++ b/ares_parse_soa_reply.c
@@ -69,6 +69,9 @@ ares_parse_soa_reply(const unsigned char *abuf, int alen,
status = ares__expand_name_for_response(aptr, abuf, alen, &qname, &len);
if (status != ARES_SUCCESS)
goto failed_stat;
+
+ if (alen <= len + HFIXEDSZ + 1)
+ goto failed;
aptr += len;
qclass = DNS_QUESTION_TYPE(aptr);

View File

@ -1,6 +1,6 @@
Name: c-ares Name: c-ares
Version: 1.16.0 Version: 1.16.0
Release: 1 Release: 2
Summary: A C library for asynchronous DNS requests Summary: A C library for asynchronous DNS requests
License: MIT License: MIT
@ -10,6 +10,7 @@ Source0: https://github.com/c-ares/c-ares/releases/tag/%{name}-%{version}
BuildRequires: gcc autoconf automake libtool BuildRequires: gcc autoconf automake libtool
# Patch0 from Redhat is applied for stopping overriding AC_CONFIG_MACRO_DIR # Patch0 from Redhat is applied for stopping overriding AC_CONFIG_MACRO_DIR
Patch0: 0001-Use-RPM-compiler-options.patch Patch0: 0001-Use-RPM-compiler-options.patch
Patch1: 0002-Fix-invalid-read-in-ares_parse_soa_reply.patch
%description %description
This is c-ares, an asynchronous resolver library. It is intended for applications This is c-ares, an asynchronous resolver library. It is intended for applications
which need to perform DNS queries without blocking, or need to perform multiple which need to perform DNS queries without blocking, or need to perform multiple
@ -52,6 +53,12 @@ make %{?_smp_mflags}
%{_mandir}/man3/* %{_mandir}/man3/*
%changelog %changelog
* Sat May 23 2020 lutianxiong<lutianxiong@huawei.com> - 1.16.0-2
- Type:bugfix
- ID:NA
- SUG:NA
- DESC: Fix invalid read in ares_parse_soa_reply.c found during fuzzing
* Fri Apr 17 2020 liaichun<liaichun@huawei.com> - 1.16.0-1 * Fri Apr 17 2020 liaichun<liaichun@huawei.com> - 1.16.0-1
- Type:bugfix - Type:bugfix
- ID:NA - ID:NA