diff options
author | 2014-10-11 03:10:06 +0000 | |
---|---|---|
committer | 2014-10-11 03:10:06 +0000 | |
commit | 240788dd62579bfffb05cf48c635fdb0cf91048f (patch) | |
tree | f4c3177b40714fad65573147ffed9407df9d8b6c /lib/libedit/filecomplete.c | |
parent | Userland reallocarray() audit. (diff) | |
download | wireguard-openbsd-240788dd62579bfffb05cf48c635fdb0cf91048f.tar.xz wireguard-openbsd-240788dd62579bfffb05cf48c635fdb0cf91048f.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/libedit/filecomplete.c')
-rw-r--r-- | lib/libedit/filecomplete.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/libedit/filecomplete.c b/lib/libedit/filecomplete.c index c38cbad8891..a6de8de79fa 100644 --- a/lib/libedit/filecomplete.c +++ b/lib/libedit/filecomplete.c @@ -1,4 +1,4 @@ -/* $OpenBSD: filecomplete.c,v 1.2 2011/07/07 05:40:42 okan Exp $ */ +/* $OpenBSD: filecomplete.c,v 1.3 2014/10/11 03:10:06 doug Exp $ */ /* $NetBSD: filecomplete.c,v 1.22 2010/12/02 04:42:46 dholland Exp $ */ /*- @@ -284,8 +284,8 @@ completion_matches(const char *text, char *(*genfunc)(const char *, int)) char **nmatch_list; while (matches + 3 >= match_list_len) match_list_len <<= 1; - nmatch_list = realloc(match_list, - match_list_len * sizeof(char *)); + nmatch_list = reallocarray(match_list, + match_list_len, sizeof(char *)); if (nmatch_list == NULL) { free(match_list); return NULL; |