summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--hivex/hivex.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/hivex/hivex.c b/hivex/hivex.c
index 4fa3b301..ac463465 100644
--- a/hivex/hivex.c
+++ b/hivex/hivex.c
@@ -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 {