about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorserpilliere <devnull@localhost>2012-07-20 15:50:42 +0200
committerserpilliere <devnull@localhost>2012-07-20 15:50:42 +0200
commit821afb043e4f09bcd7d816ef4ecd78944190c7eb (patch)
tree98971673c00549e64ef0380696cb54334d7ff2e8
parent0aa096a564415725f4a4f39f45df67e011ffebb6 (diff)
downloadmiasm-821afb043e4f09bcd7d816ef4ecd78944190c7eb.tar.gz
miasm-821afb043e4f09bcd7d816ef4ecd78944190c7eb.zip
win_api: fix get_str_ansi and get_str_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 43ca5fe4..78ced998 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 vm_get_str(tmp, 1) != "\x00":
+    while 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 vm_get_str(tmp, 2) != "\x00\x00":
+    while l < max_char and vm_get_str(tmp, 2) != "\x00\x00":
         tmp +=2
         l+=2
     return vm_get_str(ad_str, l)