From bb45555cf9e77b2f5363d25157d22cfd8958c902 Mon Sep 17 00:00:00 2001 From: David Cantrell Date: Jan 17 2008 22:54:44 +0000 Subject: - Patch read_function() to handle size_t from read() correctly (#429207) --- diff --git a/dhcp-4.0.0-parser.patch b/dhcp-4.0.0-parser.patch index b38c895..45ddf08 100644 --- a/dhcp-4.0.0-parser.patch +++ b/dhcp-4.0.0-parser.patch @@ -1,18 +1,25 @@ diff -up dhcp-4.0.0/common/conflex.c.parse dhcp-4.0.0/common/conflex.c ---- dhcp-4.0.0/common/conflex.c.parse 2008-01-16 15:26:09.000000000 -1000 -+++ dhcp-4.0.0/common/conflex.c 2008-01-16 16:02:48.000000000 -1000 -@@ -182,8 +182,12 @@ static int get_char (cfile) - c = EOF; - } +--- dhcp-4.0.0/common/conflex.c.parse 2008-01-17 09:05:17.000000000 -1000 ++++ dhcp-4.0.0/common/conflex.c 2008-01-17 09:06:48.000000000 -1000 +@@ -1434,16 +1438,18 @@ read_function (struct parse * cfile) + { + int c; + +- cfile -> buflen = read (cfile -> file, cfile -> inbuf, cfile -> bufsiz); +- if (cfile -> buflen == 0) { ++ ssize_t n = read (cfile -> file, cfile -> inbuf, cfile -> bufsiz); ++ if (n == 0) { + c = EOF; + cfile -> bufix = 0; +- } else if (cfile -> buflen < 0) { ++ cfile -> buflen = 0; ++ } else if (n < 0) { + c = EOF; + cfile -> bufix = cfile -> buflen = 0; } else { -- c = cfile->inbuf [cfile->bufix]; -- cfile->bufix++; -+ if (strlen(cfile->inbuf) >= (cfile->bufix + 1)) { -+ c = EOF; -+ } else { -+ c = cfile->inbuf [cfile->bufix]; -+ cfile->bufix++; -+ } + c = cfile -> inbuf [0]; + cfile -> bufix = 1; ++ cfile -> buflen = n; } - if (!cfile->ugflag) { + return c; diff --git a/dhcp.spec b/dhcp.spec index 64837b2..55e6584 100644 --- a/dhcp.spec +++ b/dhcp.spec @@ -4,7 +4,7 @@ Summary: DHCP (Dynamic Host Configuration Protocol) server and relay agent Name: dhcp Version: 4.0.0 -Release: 4%{?dist} +Release: 5%{?dist} # NEVER CHANGE THE EPOCH on this package. The previous maintainer made # incorrect use of the epoch and that's why it is at 12 now. It should have # never been used, but it was. So we are stuck with it. @@ -404,6 +404,9 @@ fi %{_libdir}/libdhcp4client.so %changelog +* Thu Jan 17 2008 David Cantrell - 12:4.0.0-5 +- Patch read_function() to handle size_t from read() correctly (#429207) + * Wed Jan 16 2008 David Cantrell - 12:4.0.0-4 - Fix dhclient.lease file parsing problems (#428785) - Disable IPv6 support for now as we already ship dhcpv6 (#428987)