Hi
cppcheck static analyzer gives this warning which points
to a potential bug:
[mbyte.c:4360]: (style) Array index 'i' is used before limits check.
Fixed in attached patch.
Dominique
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.
diff --git a/src/mbyte.c b/src/mbyte.c
index 7bc184b..f85d5ad 100644
--- a/src/mbyte.c
+++ b/src/mbyte.c
@@ -4357,7 +4357,7 @@ enc_locale(void)
else
s = p + 1;
}
- for (i = 0; s[i] != NUL && i < (int)sizeof(buf) - 1; ++i)
+ for (i = 0; i < (int)sizeof(buf) - 1 && s[i] != NUL; ++i)
{
if (s[i] == '_' || s[i] == '-')
buf[i] = '-';