diff options
author | pfg <pfg@FreeBSD.org> | 2017-05-09 23:31:09 +0000 |
---|---|---|
committer | pfg <pfg@FreeBSD.org> | 2017-05-09 23:31:09 +0000 |
commit | 9498b1d27a47f26ccd6e4233ad479503fc73c207 (patch) | |
tree | 74b09547df77f0a50b0162e21daab37fb0bc1ed5 /lib/libiconv_modules/ISO2022/citrus_iso2022.c | |
parent | 643d95272bd8bc6a4fd1c99b1e560e28ea4f57c7 (diff) | |
download | FreeBSD-src-9498b1d27a47f26ccd6e4233ad479503fc73c207.zip FreeBSD-src-9498b1d27a47f26ccd6e4233ad479503fc73c207.tar.gz |
MFC r317265:
lib: initial use of reallocarray(3).
Make some use of reallocarray, attempting to limit it to cases where the
parameters are unsigned and there is some theoretical chance of overflow.
Diffstat (limited to 'lib/libiconv_modules/ISO2022/citrus_iso2022.c')
-rw-r--r-- | lib/libiconv_modules/ISO2022/citrus_iso2022.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/libiconv_modules/ISO2022/citrus_iso2022.c b/lib/libiconv_modules/ISO2022/citrus_iso2022.c index f3613d6..c88a23e 100644 --- a/lib/libiconv_modules/ISO2022/citrus_iso2022.c +++ b/lib/libiconv_modules/ISO2022/citrus_iso2022.c @@ -259,8 +259,8 @@ get_recommend(_ISO2022EncodingInfo * __restrict ei, if (!ei->recommend[i]) ei->recommend[i] = malloc(sizeof(_ISO2022Charset)); else { - p = realloc(ei->recommend[i], - sizeof(_ISO2022Charset) * (ei->recommendsize[i] + 1)); + p = reallocarray(ei->recommend[i], ei->recommendsize[i] + 1, + sizeof(_ISO2022Charset)); if (!p) return (_PARSEFAIL); ei->recommend[i] = p; |