diff options
author | Thomas Haller <thaller@redhat.com> | 2020-03-13 12:17:18 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2020-03-13 13:50:02 +0100 |
commit | 9b7b1c5ec5e550b00f190ce21e4817adc964190d (patch) | |
tree | d5a2cd19768fe48595f34ebcea215ffe8490647f | |
parent | 95cb5c0f914e194d24968613cd344734c5b7cca9 (diff) | |
download | NetworkManager-th/cli-device-wifi-cleanup.tar.gz |
cli: fix out of bounds access in _print_fill()th/cli-device-wifi-cleanup
cols_len might be larger than header_row->len. That is when
the cols has entries that are not leaf entries (which currently
I think is never the case).
Fix it to use the right variable for the length of the row.
-rw-r--r-- | clients/cli/utils.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/clients/cli/utils.c b/clients/cli/utils.c index d35ed26631..d8524c55a1 100644 --- a/clients/cli/utils.c +++ b/clients/cli/utils.c @@ -1140,7 +1140,8 @@ _print_fill (const NmcConfig *nmc_config, header_cell->width = nmc_string_screen_width (header_cell->title, NULL); for (i_row = 0; i_row < targets_len; i_row++) { - const PrintDataCell *cell = &g_array_index (cells, PrintDataCell, i_row * cols_len + i_col); + const PrintDataCell *cells_line = &g_array_index (cells, PrintDataCell, i_row * header_row->len); + const PrintDataCell *cell = &cells_line[i_col]; const char *const*i_strv; switch (cell->text_format) { |