diff options
author | 2014-10-11 03:12:13 +0000 | |
---|---|---|
committer | 2014-10-11 03:12:13 +0000 | |
commit | 804909e4c6922204199e2d5131c42f82956d8cea (patch) | |
tree | 2737d797bea992bc0444cbd7c42ef8c87828d74c /lib/libc | |
parent | Userland reallocarray() audit. (diff) | |
download | wireguard-openbsd-804909e4c6922204199e2d5131c42f82956d8cea.tar.xz wireguard-openbsd-804909e4c6922204199e2d5131c42f82956d8cea.zip |
Userland reallocarray() audit.
Avoid potential integer overflow in the size argument of malloc() and
realloc() by using reallocarray() to avoid unchecked multiplication.
ok deraadt@
Diffstat (limited to 'lib/libc')
-rw-r--r-- | lib/libc/net/getprotoent.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/libc/net/getprotoent.c b/lib/libc/net/getprotoent.c index 87060b7b3c9..7431566f856 100644 --- a/lib/libc/net/getprotoent.c +++ b/lib/libc/net/getprotoent.c @@ -1,4 +1,4 @@ -/* $OpenBSD: getprotoent.c,v 1.11 2014/09/15 06:15:48 guenther Exp $ */ +/* $OpenBSD: getprotoent.c,v 1.12 2014/10/11 03:12:13 doug Exp $ */ /* * Copyright (c) 1983, 1993 * The Regents of the University of California. All rights reserved. @@ -119,8 +119,8 @@ again: continue; } if (q == &pe->p_aliases[pd->maxaliases - 1]) { - p = realloc(pe->p_aliases, - 2 * pd->maxaliases * sizeof(char *)); + p = reallocarray(pe->p_aliases, + pd->maxaliases, 2 * sizeof(char *)); if (p == NULL) { serrno = errno; endprotoent_r(pd); |