Skip to content

Commit

Permalink
test/registry: fix array overrun
Browse files Browse the repository at this point in the history
test/registry.c:532:9: overrun-local: Overrunning array "tl->iso639" of 3
8-byte elements at element index 23 (byte offset 191) using index "i"
(which evaluates to 23).
  • Loading branch information
whot authored and wismill committed Jul 31, 2024
1 parent 4b69cd9 commit 573583e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions test/registry.c
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ cmp_layouts(struct test_layout *tl, struct rxkb_layout *l)
return false;

iso3166 = rxkb_layout_get_iso3166_first(l);
for (size_t i = 0; i < sizeof(tl->iso3166); i++) {
for (size_t i = 0; i < ARRAY_SIZE(tl->iso3166); i++) {
const char *iso = tl->iso3166[i];
if (iso == NULL && iso3166 == NULL)
break;
Expand All @@ -528,7 +528,7 @@ cmp_layouts(struct test_layout *tl, struct rxkb_layout *l)
return false;

iso639 = rxkb_layout_get_iso639_first(l);
for (size_t i = 0; i < sizeof(tl->iso639); i++) {
for (size_t i = 0; i < ARRAY_SIZE(tl->iso639); i++) {
const char *iso = tl->iso639[i];
if (iso == NULL && iso639 == NULL)
break;
Expand Down

0 comments on commit 573583e

Please sign in to comment.