From 3ea63c935af4d6edd42f8074a65fd330aed06648 Mon Sep 17 00:00:00 2001 From: songmingliang Date: Thu, 25 Jul 2024 13:23:07 +0800 Subject: [PATCH] update to libndp-1.2-10 --- ...ba7b0d126eea4c04387dcf40596059ee24af.patch | 44 +++++++++++++++++++ libndp.spec | 8 +++- 2 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 05e4ba7b0d126eea4c04387dcf40596059ee24af.patch diff --git a/05e4ba7b0d126eea4c04387dcf40596059ee24af.patch b/05e4ba7b0d126eea4c04387dcf40596059ee24af.patch new file mode 100644 index 0000000..15c9129 --- /dev/null +++ b/05e4ba7b0d126eea4c04387dcf40596059ee24af.patch @@ -0,0 +1,44 @@ +From 05e4ba7b0d126eea4c04387dcf40596059ee24af Mon Sep 17 00:00:00 2001 +From: Hangbin Liu +Date: Wed, 5 Jun 2024 11:57:43 +0800 +Subject: [PATCH] libndp: valid route information option length + +RFC 4191 specifies that the Route Information Option Length should be 1, 2, +or 3, depending on the Prefix Length. A malicious node could potentially +trigger a buffer overflow and crash the tool by sending an IPv6 router +advertisement message containing the "Route Information" option with a +"Length" field larger than 3. + +To address this, add a check on the length field. + +Fixes: 8296a5bf0755 ("add support for Route Information Option (rfc4191)") +Reported-by: Evgeny Vereshchagin +Suggested-by: Felix Maurer +Signed-off-by: Hangbin Liu +Signed-off-by: Jiri Pirko +--- + libndp/libndp.c | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +diff --git a/libndp/libndp.c b/libndp/libndp.c +index 6314717..72ec92e 100644 +--- a/libndp/libndp.c ++++ b/libndp/libndp.c +@@ -1231,6 +1231,17 @@ static bool ndp_msg_opt_route_check_valid(void *opt_data) + */ + if (((ri->nd_opt_ri_prf_reserved >> 3) & 3) == 2) + return false; ++ ++ /* The Length field is 1, 2, or 3 depending on the Prefix Length. ++ * If Prefix Length is greater than 64, then Length must be 3. ++ * If Prefix Length is greater than 0, then Length must be 2 or 3. ++ * If Prefix Length is zero, then Length must be 1, 2, or 3. ++ */ ++ if (ri->nd_opt_ri_len > 3 || ++ (ri->nd_opt_ri_prefix_len > 64 && ri->nd_opt_ri_len != 3) || ++ (ri->nd_opt_ri_prefix_len > 0 && ri->nd_opt_ri_len == 1)) ++ return false; ++ + return true; + } + diff --git a/libndp.spec b/libndp.spec index a0dafc3..5297ce6 100644 --- a/libndp.spec +++ b/libndp.spec @@ -1,6 +1,6 @@ Name: libndp Version: 1.2 -Release: 9%{?dist} +Release: 10%{?dist} Summary: Library for Neighbor Discovery Protocol Group: System Environment/Libraries License: LGPLv2+ @@ -17,6 +17,8 @@ Patch6: 0006-libndp-revert-API-change-for-ndp_msg_send-and-add-nd.patch Patch7: 0007-ndptool-add-T-target-support.patch Patch8: 0008-ndptool-fix-target-parameter-typo.patch Patch9: 0009-libndp-close-sockfd-after-using-to-avoid-handle-leak.patch +# https://github.com/jpirko/libndp/commit/05e4ba7b0d126eea4c04387dcf40596059ee24af +Patch10: 05e4ba7b0d126eea4c04387dcf40596059ee24af.patch %description This package contains a library which provides a wrapper @@ -44,6 +46,7 @@ necessary for developing programs using libndp. %patch7 -p1 -b .support-target-for-ns %patch8 -p1 -b .fix-target-parameter-typo %patch9 -p1 -b .close-sockfd-after-using +%patch10 -p1 %build %configure --disable-static @@ -69,6 +72,9 @@ find $RPM_BUILD_ROOT -name \*.la -delete %{_libdir}/pkgconfig/*.pc %changelog +* Thu Jul 25 2024 songmingliang - 1.2-10 +- update to libndp-1.2-10 + * Tue Dec 18 2018 Hangbin Liu - 1.2-8 - ndptool: add -T target support - ndptool: fix target parameter typo -- Gitee