From a7e13e5307dca19ef63b040dd585b6631da0c932 Mon Sep 17 00:00:00 2001 From: Michael Droettboom Date: Fri, 28 Dec 2018 10:19:51 -0500 Subject: [PATCH] Fix buffer overrun --- src/python2js_buffer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/python2js_buffer.c b/src/python2js_buffer.c index ba7e34877..cbb5454d5 100644 --- a/src/python2js_buffer.c +++ b/src/python2js_buffer.c @@ -428,9 +428,9 @@ static enum shareable_enum _python2js_buffer_is_shareable(Py_buffer* buff) { char* invalid_codes = ">!qQ?"; - for (int i = 0; i < 2; ++i) { + for (char* i = buff->format; *i != 0; ++i) { for (char* j = invalid_codes; *j != 0; ++j) { - if (buff->format[i] == *j) { + if (*i == *j) { return NOT_SHAREABLE; } }