From feaeb09c7553a3cb3242f6be7b39a5f4b4d5a3e7 Mon Sep 17 00:00:00 2001 From: pfg Date: Fri, 7 Apr 2017 16:08:04 +0000 Subject: MFC r315162: libc: provide some bounds-checking through reallocarray(3). reallocarray(3) is a non portable extension that originated in OpenBSD. Given that it is already in FreeBSD's libc it is useful for the cases where reallocation involves a multiplication. --- lib/libc/iconv/citrus_esdb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/libc/iconv/citrus_esdb.c') diff --git a/lib/libc/iconv/citrus_esdb.c b/lib/libc/iconv/citrus_esdb.c index f5989fd..4a07eca 100644 --- a/lib/libc/iconv/citrus_esdb.c +++ b/lib/libc/iconv/citrus_esdb.c @@ -347,7 +347,7 @@ _citrus_esdb_get_list(char ***rlist, size_t *rnum, bool sorted) ret = 0; /* XXX: why reallocing the list space posteriorly? shouldn't be done earlier? */ - q = realloc(list, num * sizeof(char *)); + q = reallocarray(list, num, sizeof(char *)); if (!q) { ret = ENOMEM; goto quit3; -- cgit v1.1