perf script: Add array bound checking to list_scripts
Don't overflow array when the scripts directory is too large, or the script file name is too long. Signed-off-by: Andi Kleen <ak@linux.intel.com> Acked-by: Jiri Olsa <jolsa@kernel.org> Link: http://lkml.kernel.org/r/20190311144502.15423-11-andi@firstfloor.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cette révision appartient à :

révisé par
Arnaldo Carvalho de Melo

Parent
ca52babe03
révision
905e4aff31
@@ -97,7 +97,8 @@ static int list_scripts(char *script_name, bool *custom,
|
||||
paths[i] = names[i] + SCRIPT_NAMELEN;
|
||||
}
|
||||
|
||||
num = find_scripts(names + max_std, paths + max_std);
|
||||
num = find_scripts(names + max_std, paths + max_std, SCRIPT_MAX_NO - max_std,
|
||||
SCRIPT_FULLPATH_LEN);
|
||||
if (num < 0)
|
||||
num = 0;
|
||||
choice = ui__popup_menu(num + max_std, (char * const *)names);
|
||||
|
Référencer dans un nouveau ticket
Bloquer un utilisateur