diff options
author | 2014-10-08 04:20:57 +0000 | |
---|---|---|
committer | 2014-10-08 04:20:57 +0000 | |
commit | d1563f2cf5f4f5685be9e94475ab0c8f8229a92a (patch) | |
tree | ecf66946ab7e40a70bd9118488093ce1cef998d7 | |
parent | add a xreallocarray() like the existing fatal xmalloc(), and use it to (diff) | |
download | wireguard-openbsd-d1563f2cf5f4f5685be9e94475ab0c8f8229a92a.tar.xz wireguard-openbsd-d1563f2cf5f4f5685be9e94475ab0c8f8229a92a.zip |
use reallocarray() instead of realloc() to handle potential integer overflow; ok doug
-rw-r--r-- | usr.sbin/cron/env.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/usr.sbin/cron/env.c b/usr.sbin/cron/env.c index 099957c6384..8fa993ac447 100644 --- a/usr.sbin/cron/env.c +++ b/usr.sbin/cron/env.c @@ -1,4 +1,4 @@ -/* $OpenBSD: env.c,v 1.23 2011/01/18 14:29:21 millert Exp $ */ +/* $OpenBSD: env.c,v 1.24 2014/10/08 04:20:57 deraadt Exp $ */ /* Copyright 1988,1990,1993,1994 by Paul Vixie * All rights reserved @@ -99,8 +99,7 @@ env_set(char **envp, char *envstr) { */ if ((envtmp = strdup(envstr)) == NULL) return (NULL); - p = (char **) realloc((void *) envp, - (size_t) ((count+1) * sizeof(char **))); + p = reallocarray(envp, count+1, sizeof(char **)); if (p == NULL) { free(envtmp); return (NULL); |