From b158a7a63b9eb4afdf123081f1a683fab268814c Mon Sep 17 00:00:00 2001 From: pancake Date: Wed, 5 Nov 2014 09:46:11 +0100 Subject: [PATCH] Fix rabin2 -z regression --- libr/bin/bin.c | 2 +- libr/util/str.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/libr/bin/bin.c b/libr/bin/bin.c index 8746dbc8c5..7a63ed378c 100644 --- a/libr/bin/bin.c +++ b/libr/bin/bin.c @@ -153,7 +153,7 @@ static int string_scan_range (RList *list, const ut8 *buf, int min, const ut64 f break; } } else { - rc = r_utf8_decode (buf+needle, needle-to, &r); + rc = r_utf8_decode (buf+needle, to-needle, &r); if (rc > 1) str_type = R_STRING_TYPE_UTF8; } diff --git a/libr/util/str.c b/libr/util/str.c index a4f3ee7c08..489750f123 100644 --- a/libr/util/str.c +++ b/libr/util/str.c @@ -895,7 +895,8 @@ R_API int r_str_ansi_len(const char *str) { R_API int r_str_nlen(const char *str, int n) { int len = 0; if (str) { - while (IS_PRINTABLE (*str) && n>0) { + //while (IS_PRINTABLE (*str) && n>0) { + while (*str && n>0) { len++; str++; n--;