Blame SOURCES/0001-lib-Don-t-leak-errno-from-_hivex_recode-function.patch

40f388
From 4b3c3cd2b3d8d34601979feeb1390fddd442ab04 Mon Sep 17 00:00:00 2001
40f388
From: "Richard W.M. Jones" <rjones@redhat.com>
40f388
Date: Thu, 20 Nov 2014 21:37:19 +0000
40f388
Subject: [PATCH] lib: Don't leak errno from _hivex_recode function.
40f388
40f388
If iconv returns E2BIG, that's an internal indication for us, and not
40f388
an error.  Don't leak the errno up to the user, as happened here:
40f388
40f388
https://www.redhat.com/archives/libguestfs/2014-November/msg00140.html
40f388
40f388
Thanks Nicolas Ecarnot.
40f388
---
40f388
 lib/utf16.c | 4 ++++
40f388
 1 file changed, 4 insertions(+)
40f388
40f388
diff --git a/lib/utf16.c b/lib/utf16.c
40f388
index fe2c3bd..238f40a 100644
40f388
--- a/lib/utf16.c
40f388
+++ b/lib/utf16.c
40f388
@@ -58,6 +58,10 @@ _hivex_recode (const char *input_encoding, const char *input, size_t input_len,
40f388
   if (r == (size_t) -1) {
40f388
     if (errno == E2BIG) {
40f388
       int err = errno;
40f388
+      /* Reset errno here because we don't want to accidentally
40f388
+       * return E2BIG to a library caller.
40f388
+       */
40f388
+      errno = 0;
40f388
       size_t prev = outalloc;
40f388
       /* Try again with a larger output buffer. */
40f388
       free (out);
40f388
-- 
40f388
2.1.0
40f388