diff options
author | pfg <pfg@FreeBSD.org> | 2017-04-07 16:08:04 +0000 |
---|---|---|
committer | pfg <pfg@FreeBSD.org> | 2017-04-07 16:08:04 +0000 |
commit | feaeb09c7553a3cb3242f6be7b39a5f4b4d5a3e7 (patch) | |
tree | 9779b1eeb4a9a1f1c6fccb20ee1fb04a426efb9d /lib/libc/stdio/printf-pos.c | |
parent | 7317fc9c0522c902a4a0a67b17c5c5d25d04bff9 (diff) | |
download | FreeBSD-src-feaeb09c7553a3cb3242f6be7b39a5f4b4d5a3e7.zip FreeBSD-src-feaeb09c7553a3cb3242f6be7b39a5f4b4d5a3e7.tar.gz |
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.
Diffstat (limited to 'lib/libc/stdio/printf-pos.c')
-rw-r--r-- | lib/libc/stdio/printf-pos.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/libc/stdio/printf-pos.c b/lib/libc/stdio/printf-pos.c index 3a47649..38cf014 100644 --- a/lib/libc/stdio/printf-pos.c +++ b/lib/libc/stdio/printf-pos.c @@ -633,7 +633,7 @@ __grow_type_table(struct typetable *types) return (-1); bcopy(oldtable, newtable, oldsize * sizeof(enum typeid)); } else { - newtable = realloc(oldtable, newsize * sizeof(enum typeid)); + newtable = reallocarray(oldtable, newsize, sizeof(enum typeid)); if (newtable == NULL) return (-1); } |