- Patch read_function() to handle size_t from read() correctly (#429207)

This commit is contained in:
David Cantrell 2008-01-17 22:54:44 +00:00
parent a58f607ec1
commit bb45555cf9
2 changed files with 25 additions and 15 deletions

View File

@ -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;

View File

@ -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 <dcantrell@redhat.com> - 12:4.0.0-5
- Patch read_function() to handle size_t from read() correctly (#429207)
* Wed Jan 16 2008 David Cantrell <dcantrell@redhat.com> - 12:4.0.0-4
- Fix dhclient.lease file parsing problems (#428785)
- Disable IPv6 support for now as we already ship dhcpv6 (#428987)