mirror of
https://github.com/torvalds/linux.git
synced 2026-09-23 22:14:03 +02:00
perf hists browser: Increase MAX_OPTIONS to prevent stack buffer overflow
In evsel__hists_browse(), the 'options' and 'actions' arrays are statically allocated on the stack with a size of MAX_OPTIONS (16). Further down, the function sequentially calls several add_*_opt() functions, which increment nr_options without bounds checking. Depending on the context (e.g., branch mode, scripting, annotations), the sum of added options can theoretically exceed 16 (potentially reaching up to ~19). This could lead to a stack buffer overflow. Increase MAX_OPTIONS to 32 to safely accommodate the maximum possible number of options without risking an overflow. Closes: https://lore.kernel.org/linux-perf-users/20260708235834.3FB771F00A3A@smtp.kernel.org/ Assisted-by: Antigravity:gemini-3.5-flash Signed-off-by: Ian Rogers <irogers@google.com> Link: https://lore.kernel.org/linux-perf-users/20260708235834.3FB771F00A3A@smtp.kernel.org/ Signed-off-by: Namhyung Kim <namhyung@kernel.org>
This commit is contained in:
parent
59355235f2
commit
2ec3b98587
|
|
@ -3003,7 +3003,7 @@ static int evsel__hists_browse(struct evsel *evsel, int nr_events, const char *h
|
|||
struct hists *hists = evsel__hists(evsel);
|
||||
struct hist_browser *browser = perf_evsel_browser__new(evsel, hbt, env);
|
||||
struct branch_info *bi = NULL;
|
||||
#define MAX_OPTIONS 16
|
||||
#define MAX_OPTIONS 32
|
||||
char *options[MAX_OPTIONS];
|
||||
struct popup_action actions[MAX_OPTIONS];
|
||||
int nr_options = 0;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user