X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=hivex%2Fhivex.c;h=ac463465c487b13bd2184314e954a6311bf8efd7;hb=a25d175cf6e8283288fd6d209b37b09ffee0dcf3;hp=b522ccf8622dd8d7bdef7d0fd734d91a27287227;hpb=43a8e107ce8ad6eac99da82366bdf63b401e3d31;p=libguestfs.git diff --git a/hivex/hivex.c b/hivex/hivex.c index b522ccf..ac46346 100644 --- a/hivex/hivex.c +++ b/hivex/hivex.c @@ -271,6 +271,8 @@ hivex_open (const char *filename, int flags) } h->bitmap = calloc (1 + h->size / 32, 1); + if (h->bitmap == NULL) + goto error; #if 0 /* Doesn't work. */ /* Header checksum. */ @@ -1031,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 {