diff options
author | Doug Hogan <doug@cvs.openbsd.org> | 2014-10-11 03:10:07 +0000 |
---|---|---|
committer | Doug Hogan <doug@cvs.openbsd.org> | 2014-10-11 03:10:07 +0000 |
commit | f445a972b33e028ce623941bf768b6956c4853dd (patch) | |
tree | 808c5e2edc55421a7f08dc0ea93940364c783fc5 | |
parent | 1a7eef7a38b0f9441fcef01e7d2fde0601d00041 (diff) |
Userland reallocarray() audit.
Avoid potential integer overflow in the size argument of malloc() and
realloc() by using reallocarray() to avoid unchecked multiplication.
ok deraadt@
-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; |