arpwatch/arpwatch-2.1a15-unbounded-hostname-copy.patch
Pavel Simovec 6c23d5c551 Give a bound to hostname buffer copy
Resolves RHEL-5636
2024-02-21 12:07:10 +01:00

16 lines
377 B
Diff

--- 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);
}