[Libguestfs] [PATCH 2/7] lib: Use vk->len for string conversion

Hilko Bengen
Fri, 10 Jan 2014 23:12:47 -0000

---
 lib/value.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/lib/value.c b/lib/value.c
index 65404d7..e700c84 100644
--- a/lib/value.c
+++ b/lib/value.c
@@ -207,14 +207,8 @@ hivex_value_key (hive_h *h, hive_value_h value)
   struct ntreg_vk_record *vk      (struct ntreg_vk_record *) ((char *)
h->addr + value);

-  /* AFAIK the key is always plain ASCII, so no conversion to UTF-8 is
-   * necessary.  However we do need to nul-terminate the string.
-   */
-  errno = 0;
-  size_t len = hivex_value_key_len (h, value);
-  if (len == 0 && errno != 0)
-    return NULL;
   size_t flags = le16toh (vk->flags);
+  size_t len = le16toh (vk->name_len);
   if (flags & 0x01) {
     return _hivex_windows_latin1_to_utf8 (vk->name, len);
   } else {
--
1.8.5.2