mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-22 07:03:38 +00:00
hivex: fail upon integer overflow
* hivex/hivex.c (windows_utf16_to_utf8): Avoid overflow and a potential infloop.
This commit is contained in:
committed by
Richard Jones
parent
f95c697a44
commit
ef642eb4e3
@@ -1033,9 +1033,12 @@ windows_utf16_to_utf8 (/* const */ char *input, size_t len)
|
||||
size_t r = iconv (ic, &inp, &inlen, &outp, &outlen);
|
||||
if (r == (size_t) -1) {
|
||||
if (errno == E2BIG) {
|
||||
size_t prev = outalloc;
|
||||
/* Try again with a larger output buffer. */
|
||||
free (out);
|
||||
outalloc *= 2;
|
||||
if (outalloc < prev)
|
||||
return NULL;
|
||||
goto again;
|
||||
}
|
||||
else {
|
||||
|
||||
Reference in New Issue
Block a user