From 0a35ee0ad4b9259b4fe08d9102b18a54576a0679 Mon Sep 17 00:00:00 2001 From: houyingchao <1348375921@qq.com> Date: Wed, 14 Jul 2021 10:02:21 +0800 Subject: [PATCH] fix CVE-2021-3571 (cherry picked from commit 40fad8d453dc3c60e16571217437494c18307fd9) --- CVE-2021-3571.patch | 26 ++++++++++++++++++++++++++ linuxptp.spec | 8 +++++++- 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 CVE-2021-3571.patch diff --git a/CVE-2021-3571.patch b/CVE-2021-3571.patch new file mode 100644 index 0000000..5752514 --- /dev/null +++ b/CVE-2021-3571.patch @@ -0,0 +1,26 @@ +From d61d77e163dbee247819f3d88593ba111577af15 Mon Sep 17 00:00:00 2001 +From: Miroslav Lichvar +Date: Fri, 26 Mar 2021 09:57:43 +0100 +Subject: [PATCH] tc: Fix length of follow-up message of one-step sync. + +Convert the length of the generated follow-up message to network order. +This fixes reading and sending of data past the message buffer. + +Signed-off-by: Miroslav Lichvar +--- + tc.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tc.c b/tc.c +index d9e4853..2e3830c 100644 +--- a/tc.c ++++ b/tc.c +@@ -452,7 +452,7 @@ int tc_fwd_sync(struct port *q, struct ptp_message *msg) + } + fup->header.tsmt = FOLLOW_UP | (msg->header.tsmt & 0xf0); + fup->header.ver = msg->header.ver; +- fup->header.messageLength = sizeof(struct follow_up_msg); ++ fup->header.messageLength = htons(sizeof(struct follow_up_msg)); + fup->header.domainNumber = msg->header.domainNumber; + fup->header.sourcePortIdentity = msg->header.sourcePortIdentity; + fup->header.sequenceId = msg->header.sequenceId; diff --git a/linuxptp.spec b/linuxptp.spec index a00959d..90c7eb8 100644 --- a/linuxptp.spec +++ b/linuxptp.spec @@ -1,6 +1,6 @@ Name: linuxptp Version: 2.0 -Release: 3 +Release: 4 Summary: Linuxptp is an implementation of the Precision Time Protocol (PTP) Group: System Environment/Base License: GPLv2+ @@ -8,6 +8,9 @@ URL: http://linuxptp.sourceforge.net/ Source0: https://downloads.sourceforge.net/%{name}/%{name}-%{version}.tgz Source1: phc2sys.service Source2: ptp4l.service + +patch0000: CVE-2021-3571.patch + BuildRequires: gcc gcc-c++ systemd git net-tools @@ -77,6 +80,9 @@ echo 'OPTIONS="-a -r"' > %{buildroot}%{_sysconfdir}/sysconfig/phc2sys %{_mandir}/man8/*.8* %changelog +* Wed Jul 14 2021 houyingchao - 2.0-4 +- fix CVE-2021-3571 + * Thu Nov 28 2019 openEuler BuildTeam 2.0-3 - Package Init -- Gitee