[Libguestfs] [hivex PATCH 1/5] Really fix the case where a UTF-16 string contains junk after the string.

Richard W.M. Jones rjones at redhat.com
Wed Apr 13 13:17:37 UTC 2011


-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
New in Fedora 11: Fedora Windows cross-compiler. Compile Windows
programs, test, and build Windows installers. Over 70 libraries supprt'd
http://fedoraproject.org/wiki/MinGW http://www.annexia.org/fedora_mingw
-------------- next part --------------
>From 3e941d7ef4163b8882b1296adfd837c507a81075 Mon Sep 17 00:00:00 2001
From: Richard W.M. Jones <rjones at redhat.com>
Date: Wed, 13 Apr 2011 13:54:05 +0100
Subject: [PATCH 1/5] Really fix the case where a UTF-16 string contains junk after the string.

The previous commit b71b88f588f8660935a7d462e97b84aa2d669249 attempted
to fix this, but got the test the wrong way round so the length would
never be shorter.
---
 lib/hivex.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/lib/hivex.c b/lib/hivex.c
index 860c85c..3f4c629 100644
--- a/lib/hivex.c
+++ b/lib/hivex.c
@@ -1335,7 +1335,7 @@ hivex_value_string (hive_h *h, hive_value_h value)
    * (Found by Hilko Bengen in a fresh Windows XP SOFTWARE hive).
    */
   size_t slen = utf16_string_len_in_bytes_max (data, len);
-  if (slen > len)
+  if (slen < len)
     len = slen;
 
   char *ret = windows_utf16_to_utf8 (data, len);
-- 
1.7.4.1



More information about the Libguestfs mailing list