Fix memory corruption in ldns_rr_new_frm_fp_l (#1511046)

Signed-off-by: Petr Menšík <pemensik@redhat.com>
This commit is contained in:
Petr Menšík 2017-11-09 17:05:12 +01:00
parent 29c0a6a545
commit 34b80520a8
2 changed files with 34 additions and 1 deletions

View File

@ -0,0 +1,28 @@
From c8391790c96d4c8a2c10f9ab1460fda83b509fc2 Mon Sep 17 00:00:00 2001
From: Willem Toorop <willem@nlnetlabs.nl>
Date: Thu, 27 Apr 2017 00:14:58 +0200
Subject: [PATCH] Check parse limit before t increment
Thanks Stephan Zeisberg
---
parse.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/parse.c b/parse.c
index e68627c..947dbb8 100644
--- a/parse.c
+++ b/parse.c
@@ -118,6 +118,10 @@ ldns_fget_token_l(FILE *f, char *token, const char *delim, size_t limit, int *li
if (line_nr) {
*line_nr = *line_nr + 1;
}
+ if (limit > 0 && (i >= limit || (size_t)(t-token) >= limit)) {
+ *t = '\0';
+ return -1;
+ }
*t++ = ' ';
prev_c = c;
continue;
--
2.9.5

View File

@ -26,12 +26,13 @@
Summary: Low-level DNS(SEC) library with API
Name: ldns
Version: 1.7.0
Release: 8%{?dist}
Release: 9%{?dist}
License: BSD
Url: http://www.nlnetlabs.nl/%{name}/
Source0: http://www.nlnetlabs.nl/downloads/%{name}/%{name}-%{version}.tar.gz
Patch1: ldns-1.7.0-multilib.patch
Patch2: ldns-1.7.0-parse-limit.patch
Group: System Environment/Libraries
# Only needed for builds from svn snapshot
@ -114,6 +115,7 @@ This package contains documentation for the ldns library
%prep
%setup -q
%patch1 -p1
%patch2 -p1 -b .limit
# To built svn snapshots
# rm config.guess config.sub ltmain.sh
# aclocal
@ -272,6 +274,9 @@ rm -rf %{buildroot}
%doc doc
%changelog
* Thu Nov 09 2017 Petr Menšík <pemensik@redhat.com> - 1.7.0-9
- Fix memory corruption in ldns_rr_new_frm_fp_l (#1511046)
* Sat Aug 19 2017 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 1.7.0-8
- Python 2 binary package renamed to python2-ldns
See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3