mirror of git://sourceware.org/git/glibc.git
libio: Fix UB __libio_codecvt_length
To avoid a 0 size VLA.
This commit is contained in:
parent
43ba3b5c3a
commit
b5a09ebb3f
|
|
@ -228,6 +228,9 @@ __libio_codecvt_length (struct _IO_codecvt *codecvt, __mbstate_t *statep,
|
||||||
const char *from_start, const char *from_end,
|
const char *from_start, const char *from_end,
|
||||||
size_t max)
|
size_t max)
|
||||||
{
|
{
|
||||||
|
if (max == 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
int result;
|
int result;
|
||||||
const unsigned char *cp = (const unsigned char *) from_start;
|
const unsigned char *cp = (const unsigned char *) from_start;
|
||||||
wchar_t to_buf[max];
|
wchar_t to_buf[max];
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue