diff options
author | 2014-10-08 04:26:07 +0000 | |
---|---|---|
committer | 2014-10-08 04:26:07 +0000 | |
commit | f4e02bb462d7b22dac4ccbfa41db2ffbb03135b5 (patch) | |
tree | 4f9e48bf0640491f61db660277978cb13a86b376 | |
parent | use reallocarray() instead of realloc() to handle potential integer overflow; ok doug (diff) | |
download | wireguard-openbsd-f4e02bb462d7b22dac4ccbfa41db2ffbb03135b5.tar.xz wireguard-openbsd-f4e02bb462d7b22dac4ccbfa41db2ffbb03135b5.zip |
use reallocarray() to cope with multiplicative integer overflow; ok doug
-rw-r--r-- | usr.sbin/dhcpd/dispatch.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/usr.sbin/dhcpd/dispatch.c b/usr.sbin/dhcpd/dispatch.c index 776506d55b4..ceb3856887b 100644 --- a/usr.sbin/dhcpd/dispatch.c +++ b/usr.sbin/dhcpd/dispatch.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dispatch.c,v 1.33 2014/05/05 18:30:44 pelikan Exp $ */ +/* $OpenBSD: dispatch.c,v 1.34 2014/10/08 04:26:07 deraadt Exp $ */ /* * Copyright (c) 1995, 1996, 1997, 1998, 1999 @@ -291,7 +291,7 @@ dispatch(void) if (syncfd != -1) nfds++; if (nfds > nfds_max) { - fds = realloc(fds, nfds * sizeof(struct pollfd)); + fds = reallocarray(fds, nfds, sizeof(struct pollfd)); if (fds == NULL) error("Can't allocate poll structures."); nfds_max = nfds; |