From 72fdc6a5273bfc9bba63f86c3c3b2632dbd7da8b Mon Sep 17 00:00:00 2001 From: jsteube Date: Tue, 4 Oct 2016 23:25:35 +0200 Subject: [PATCH] Limit exec_hexify() to max 32 chars --- src/convert.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/convert.c b/src/convert.c index 43abc01a6..0dfa20d78 100644 --- a/src/convert.c +++ b/src/convert.c @@ -22,7 +22,9 @@ bool need_hexify (const u8 *buf, const int len) void exec_hexify (const u8 *buf, const int len, u8 *out) { - for (int i = len - 1, j = i * 2; i >= 0; i -= 1, j -= 2) + const int max_len = (len >= 32) ? 32 : len; + + for (int i = max_len - 1, j = i * 2; i >= 0; i -= 1, j -= 2) { const u8 v = buf[i];