From 0f36ed4d5e7259a145ecbe2ee4d931e2f02c9c0a Mon Sep 17 00:00:00 2001 From: quanhongfei <2506045831@qq.com> Date: Tue, 29 Dec 2020 14:15:20 +0800 Subject: [PATCH] fix dhcp 64_bit lease parse --- bugfix-dhcp-64-bit-lease-parse.patch | 76 ++++++++++++++++++++++++++++ dhcp.spec | 9 +++- 2 files changed, 84 insertions(+), 1 deletion(-) create mode 100644 bugfix-dhcp-64-bit-lease-parse.patch diff --git a/bugfix-dhcp-64-bit-lease-parse.patch b/bugfix-dhcp-64-bit-lease-parse.patch new file mode 100644 index 0000000..0488c54 --- /dev/null +++ b/bugfix-dhcp-64-bit-lease-parse.patch @@ -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, diff --git a/dhcp.spec b/dhcp.spec index 9ac1626..6cf1895 100644 --- a/dhcp.spec +++ b/dhcp.spec @@ -3,7 +3,7 @@ Name: dhcp Version: 4.4.2 -Release: 3 +Release: 4 Summary: Dynamic host configuration protocol software #Please don't change the epoch on this package Epoch: 12 @@ -53,6 +53,7 @@ Patch30: bugfix-dhcpd-2038-problem.patch Patch31: dhcpd-coredump-infiniband.patch Patch32: bugfix-dhclient-check-if-pid-was-held.patch Patch33: bugfix-error-message-display.patch +Patch34: bugfix-dhcp-64-bit-lease-parse.patch BuildRequires: gcc autoconf automake libtool openldap-devel krb5-devel libcap-ng-devel bind-export-devel BuildRequires: systemd systemd-devel @@ -292,6 +293,12 @@ exit 0 %{_mandir}/man3/omapi.3.gz %changelog +* Tue Dec 29 2020 quanhongfei - 4.4.2-4 +- Type:bugfix +- ID:NA +- SUG:restart +- DESC:fix dhcp 64_bit lease parse + * Wed Dec 09 2020 gaihuiying - 4.4.2-3 - Type:bugfix - ID:NA -- Gitee