Give a bound to hostname buffer copy

Resolves RHEL-5636
This commit is contained in:
Pavel Simovec 2024-02-21 12:03:06 +01:00
parent ff7458fe93
commit 6c23d5c551
2 changed files with 22 additions and 1 deletions

View File

@ -0,0 +1,15 @@
--- a/db.c 2024-01-03 10:36:30.009600848 +0100
+++ b/db.c 2024-02-21 11:35:04.420115207 +0100
@@ -283,8 +283,10 @@
BCOPY(e, ep->e, 6);
if (h == NULL && !initializing)
h = getsname(a);
- if (h != NULL && !isdigit((int)*h))
- strcpy(ep->h, h);
+ if (h != NULL) {
+ strncpy(ep->h, h, sizeof(ep->h));
+ ep->h[sizeof(ep->h) - 1] = '\0';
+ }
ep->t = t;
return (ep);
}

View File

@ -4,7 +4,7 @@
Name: arpwatch Name: arpwatch
Epoch: 14 Epoch: 14
Version: 2.1a15 Version: 2.1a15
Release: 45%{?dist} Release: 46%{?dist}
Summary: Network monitoring tools for tracking IP addresses on a network Summary: Network monitoring tools for tracking IP addresses on a network
Group: Applications/System Group: Applications/System
License: BSD with advertising License: BSD with advertising
@ -42,6 +42,7 @@ Patch18: arpwatch-aarch64.patch
Patch19: arpwatch-promisc.patch Patch19: arpwatch-promisc.patch
Patch20: arpwatch-ethernet-address-format.patch Patch20: arpwatch-ethernet-address-format.patch
Patch21: arpwatch-2.1a15-hostname-buffer.patch Patch21: arpwatch-2.1a15-hostname-buffer.patch
Patch22: arpwatch-2.1a15-unbounded-hostname-copy.patch
%description %description
The arpwatch package contains arpwatch and arpsnmp. Arpwatch and The arpwatch package contains arpwatch and arpsnmp. Arpwatch and
@ -76,6 +77,7 @@ network.
%patch19 -p1 -b .promisc %patch19 -p1 -b .promisc
%patch20 -p1 -b .ethernet-address %patch20 -p1 -b .ethernet-address
%patch21 -p1 -b .hostname-buffer %patch21 -p1 -b .hostname-buffer
%patch22 -p1 -b .hostname-buffer-bound
%build %build
%configure %configure
@ -152,6 +154,10 @@ fi
%attr(0644,-,arpwatch) %verify(not md5 size mtime) %config(noreplace) %{_vararpwatch}/ethercodes.dat %attr(0644,-,arpwatch) %verify(not md5 size mtime) %config(noreplace) %{_vararpwatch}/ethercodes.dat
%changelog %changelog
* Wed Feb 21 2024 Pavel Simovec <psimovec@redhat.com> - 14:2.1a15-46
- Give a bound to hostname buffer copy
- Resolves: RHEL-5636
* Thu Jan 25 2024 Pavel Simovec <psimovec@redhat.com> - 14:2.1a15-45 * Thu Jan 25 2024 Pavel Simovec <psimovec@redhat.com> - 14:2.1a15-45
- rebuilt - rebuilt