Never loop up to _and including_ lenof(array).
[sgt/charset] / iso2022.c
index 7d9f028..6297b91 100644 (file)
--- a/iso2022.c
+++ b/iso2022.c
@@ -195,7 +195,7 @@ static void designate(charset_state *state, int container,
     assert(container >= 0 && container <= 3);
     assert(type == S4 || type == S6 || type == M4 || type == M6);
 
-    for (i = 0; i <= lenof(iso2022_subcharsets); i++) {
+    for (i = 0; i < lenof(iso2022_subcharsets); i++) {
        if (iso2022_subcharsets[i].type == type &&
            iso2022_subcharsets[i].i == ibyte &&
            iso2022_subcharsets[i].f == fbyte) {