!27 dhcp:solve dhcp 64_bit lease parse

From: @quanhongfei
Reviewed-by: @zengwefeng
Signed-off-by: @zengwefeng
This commit is contained in:
openeuler-ci-bot 2020-12-29 18:34:41 +08:00 committed by Gitee
commit 00ccd9450c
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
Version: 4.4.2
Release: 1
Release: 2
Summary: Dynamic host configuration protocol software
#Please don't change the epoch on this package
Epoch: 12
@ -48,6 +48,7 @@ Patch27: 0027-Add-missed-sd-notify-patch-to-manage-dhcpd-with-syst.patch
Patch6003: bugfix-dhcp-4.2.5-check-dhclient-pid.patch
Patch6004: bugfix-reduce-getifaddr-calls.patch
Patch6005: bugfix-dhcp-64-bit-lease-parse.patch
Patch9001: bugfix-dhcpd-2038-problem.patch
Patch9003: dhcpd-coredump-infiniband.patch
@ -290,6 +291,12 @@ exit 0
%{_mandir}/man3/omapi.3.gz
%changelog
* Tue Dec 29 2020 quanhongfei <quanhongfei@huawei.com> - 4.4.2-2
- Type:bugfix
- ID:NA
- SUG:restart
- DESC:fix dhcp 64_bit lease parse
* Tue Nov 10 2020 quanhongfei<quanhongfei@huawei.com> - 4.4.2-1
- Type:requirement
- ID:NA