fix dhcp 64_bit lease parse

This commit is contained in:
quanhongfei 2020-12-29 14:51:18 +08:00
parent 4079c6f6f6
commit 59758e160a
2 changed files with 84 additions and 1 deletions

View File

@ -0,0 +1,76 @@
diff --git a/common/parse.c b/common/parse.c
index 386a632..6ebbc9b 100644
--- a/common/parse.c
+++ b/common/parse.c
@@ -943,8 +943,8 @@ TIME
parse_date_core(cfile)
struct parse *cfile;
{
- int guess;
- int tzoff, year, mon, mday, hour, min, sec;
+ TIME guess;
+ long int tzoff, year, mon, mday, hour, min, sec;
const char *val;
enum dhcp_token token;
static int months[11] = { 31, 59, 90, 120, 151, 181,
@@ -970,7 +970,7 @@ parse_date_core(cfile)
}
skip_token(&val, NULL, cfile); /* consume number */
- guess = atoi(val);
+ guess = atol(val);
return((TIME)guess);
}
@@ -998,7 +998,7 @@ parse_date_core(cfile)
somebody invents a time machine, I think we can safely disregard
it. This actually works around a stupid Y2K bug that was present
in a very early beta release of dhcpd. */
- year = atoi(val);
+ year = atol(val);
if (year > 1900)
year -= 1900;
@@ -1044,7 +1044,7 @@ parse_date_core(cfile)
return((TIME)0);
}
skip_token(&val, NULL, cfile); /* consume day of month */
- mday = atoi(val);
+ mday = atol(val);
/* Hour... */
token = peek_token(&val, NULL, cfile);
@@ -1055,7 +1055,7 @@ parse_date_core(cfile)
return((TIME)0);
}
skip_token(&val, NULL, cfile); /* consume hour */
- hour = atoi(val);
+ hour = atol(val);
/* Colon separating hour from minute... */
token = peek_token(&val, NULL, cfile);
@@ -1077,7 +1077,7 @@ parse_date_core(cfile)
return((TIME)0);
}
skip_token(&val, NULL, cfile); /* consume minute */
- min = atoi(val);
+ min = atol(val);
/* Colon separating minute from second... */
token = peek_token(&val, NULL, cfile);
@@ -1099,13 +1099,13 @@ parse_date_core(cfile)
return((TIME)0);
}
skip_token(&val, NULL, cfile); /* consume second */
- sec = atoi(val);
+ sec = atol(val);
tzoff = 0;
token = peek_token(&val, NULL, cfile);
if (token == NUMBER) {
skip_token(&val, NULL, cfile); /* consume tzoff */
- tzoff = atoi(val);
+ tzoff = atol(val);
} else if (token != SEMI) {
skip_token(&val, NULL, cfile);
parse_warn(cfile,

View File

@ -3,7 +3,7 @@
Name: dhcp Name: dhcp
Version: 4.4.2 Version: 4.4.2
Release: 3 Release: 4
Summary: Dynamic host configuration protocol software Summary: Dynamic host configuration protocol software
#Please don't change the epoch on this package #Please don't change the epoch on this package
Epoch: 12 Epoch: 12
@ -52,6 +52,7 @@ Patch29: bugfix-reduce-getifaddr-calls.patch
Patch30: bugfix-dhcpd-2038-problem.patch Patch30: bugfix-dhcpd-2038-problem.patch
Patch31: dhcpd-coredump-infiniband.patch Patch31: dhcpd-coredump-infiniband.patch
Patch32: bugfix-dhclient-check-if-pid-was-held.patch Patch32: bugfix-dhclient-check-if-pid-was-held.patch
Patch33: bugfix-dhcp-64-bit-lease-parse.patch
BuildRequires: gcc autoconf automake libtool openldap-devel krb5-devel libcap-ng-devel bind-export-devel BuildRequires: gcc autoconf automake libtool openldap-devel krb5-devel libcap-ng-devel bind-export-devel
BuildRequires: systemd systemd-devel BuildRequires: systemd systemd-devel
@ -290,6 +291,12 @@ exit 0
%{_mandir}/man3/omapi.3.gz %{_mandir}/man3/omapi.3.gz
%changelog %changelog
* Tue Dec 29 2020 quanhongfei <quanhongfei@huawei.com> - 4.4.2-4
- Type:bugfix
- ID:NA
- SUG:restart
- DESC:fix dhcp 64_bit lease parse
* Thu Sep 10 2020 gaihuiying <gaihuiying1@huawei.com> - 4.4.2-3 * Thu Sep 10 2020 gaihuiying <gaihuiying1@huawei.com> - 4.4.2-3
- Type:bugfix - Type:bugfix
- ID:NA - ID:NA