From 821afb043e4f09bcd7d816ef4ecd78944190c7eb Mon Sep 17 00:00:00 2001 From: serpilliere Date: Fri, 20 Jul 2012 15:50:42 +0200 Subject: win_api: fix get_str_ansi and get_str_unic --- miasm/tools/win_api.py | 4 ++-- 1 file 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) -- cgit 1.4.1