about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorserpilliere <devnull@localhost>2012-07-26 15:06:44 +0200
committerserpilliere <devnull@localhost>2012-07-26 15:06:44 +0200
commitdaafebd2a0e0e3941ac5415ea12b4620988035f1 (patch)
tree8e647382d6bbe97b589d57b1e458dd905a420ba3
parent821afb043e4f09bcd7d816ef4ecd78944190c7eb (diff)
downloadmiasm-daafebd2a0e0e3941ac5415ea12b4620988035f1.tar.gz
miasm-daafebd2a0e0e3941ac5415ea12b4620988035f1.zip
win_api: fix get_str_ansi/unic
-rw-r--r--miasm/tools/win_api.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/miasm/tools/win_api.py b/miasm/tools/win_api.py
index 78ced998..ce46094c 100644
--- a/miasm/tools/win_api.py
+++ b/miasm/tools/win_api.py
@@ -176,7 +176,7 @@ class mdl:
 def get_str_ansi(ad_str, max_char = None):
     l = 0
     tmp = ad_str
-    while l < max_char and vm_get_str(tmp, 1) != "\x00":
+    while (max_char == None or l < max_char) and vm_get_str(tmp, 1) != "\x00":
         tmp +=1
         l+=1
     return vm_get_str(ad_str, l)
@@ -184,7 +184,7 @@ def get_str_ansi(ad_str, max_char = None):
 def get_str_unic(ad_str, max_char = None):
     l = 0
     tmp = ad_str
-    while l < max_char and vm_get_str(tmp, 2) != "\x00\x00":
+    while (max_char == None or l < max_char) and vm_get_str(tmp, 2) != "\x00\x00":
         tmp +=2
         l+=2
     return vm_get_str(ad_str, l)