libc: correct iconv buffer overflow

admbugs:	920
Submitted by:	Andrea Venturoli, gabor
Reported by:	Andrea Venturoli <security@netfence.it>, NetFence
Security:	CVE-2019-5600
Security:	FreeBSD-SA-19:09.iconv
This commit is contained in:
Ed Maste 2019-07-02 23:56:37 +00:00
parent 3612c1f045
commit ce5ec2c559

View File

@ -144,7 +144,7 @@ _citrus_NONE_stdenc_cstomb(struct _citrus_stdenc * __restrict ce __unused,
s[2] = (char)(idx >> 16);
*nresult = 3;
} else {
if (n < 3) {
if (n < 4) {
*nresult = (size_t)-1;
return (E2BIG);
}