aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTao Bao2017-09-07 15:38:51 -0500
committerTao Bao2017-09-08 12:50:07 -0500
commite15d7a5104978cd8399501636aec0df9c1a4823c (patch)
tree7687f86225f3725f505c6ee1d3f59e21d041c40b /screen_ui.h
parent8c753f62538b2008e726c66def9bf47aeed7afe1 (diff)
downloadplatform-bootable-recovery-e15d7a5104978cd8399501636aec0df9c1a4823c.tar.gz
platform-bootable-recovery-e15d7a5104978cd8399501636aec0df9c1a4823c.tar.xz
platform-bootable-recovery-e15d7a5104978cd8399501636aec0df9c1a4823c.zip
ui: Manage menu_ with std::vector.
Prior to this CL, menu_ is allocated with a fixed length of text_rows_. However, because we support scrollable menu in wear_ui, there might be more menu entries than text_rows_, which would lead to out-of-bounds array access. This CL addresses the issue by switching to std::vector. Bug: 65416558 Test: Run 'View recovery logs' on angler. Test: Set large margin height that leaves text_rows less than 21. Then run 'View recovery logs' with 21 menu entries. Change-Id: I5d4e3a0a097039e1104eda7d494c6269053dc894
Diffstat (limited to 'screen_ui.h')
-rw-r--r--screen_ui.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/screen_ui.h b/screen_ui.h
index 62dda755..8231a2ba 100644
--- a/screen_ui.h
+++ b/screen_ui.h
@@ -21,6 +21,7 @@
21#include <stdio.h> 21#include <stdio.h>
22 22
23#include <string> 23#include <string>
24#include <vector>
24 25
25#include "ui.h" 26#include "ui.h"
26 27
@@ -127,7 +128,7 @@ class ScreenRecoveryUI : public RecoveryUI {
127 bool show_text; 128 bool show_text;
128 bool show_text_ever; // has show_text ever been true? 129 bool show_text_ever; // has show_text ever been true?
129 130
130 char** menu_; 131 std::vector<std::string> menu_;
131 const char* const* menu_headers_; 132 const char* const* menu_headers_;
132 bool show_menu; 133 bool show_menu;
133 int menu_items, menu_sel; 134 int menu_items, menu_sel;