From 9058ccb3ebe0d6042d40dc9806bb9a7d5464c8d7 Mon Sep 17 00:00:00 2001 From: "kr.angelov" Date: Sat, 22 Jun 2013 15:39:47 +0000 Subject: [PATCH] bugfix for the word completion in the C runtime --- src/runtime/c/gu/string.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/runtime/c/gu/string.c b/src/runtime/c/gu/string.c index 7dc90e1e3..7ffd43068 100644 --- a/src/runtime/c/gu/string.c +++ b/src/runtime/c/gu/string.c @@ -352,12 +352,16 @@ gu_string_is_prefix(GuString s1, GuString s2) str2 = (char*) &p[1]; } - while (sz1 > 0 && sz2 > 0) { + + if (sz1 > sz2) + return false; + + for (size_t sz = sz1; sz--; sz > 0) { if (*str1 != *str2) return false; - str1++; sz1--; - str2++; sz2--; + str1++; + str2++; } return true;