From 3d403d88d1af499c124e8121321ad786bafa53ac Mon Sep 17 00:00:00 2001 From: quanhongfei <2506045831@qq.com> Date: Tue, 29 Dec 2020 14:39:07 +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 e50341c..7d9c079 100644 --- a/dhcp.spec +++ b/dhcp.spec @@ -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 - 4.4.2-2 +- Type:bugfix +- ID:NA +- SUG:restart +- DESC:fix dhcp 64_bit lease parse + * Tue Nov 10 2020 quanhongfei - 4.4.2-1 - Type:requirement - ID:NA -- Gitee