Module: wine Branch: master Commit: fe517f9256e9b9aaa32afb05b01198eec3e5ea17 URL: http://source.winehq.org/git/wine.git/?a=commit;h=fe517f9256e9b9aaa32afb05b0... Author: Kirill Smirnov <kirill.k.smirnov(a)gmail.com> Date: Mon May 9 19:50:44 2016 +0300 regedit: Fix an out-of-bounds array access (clang). Signed-off-by: Kirill K. Smirnov <kirill.k.smirnov(a)gmail.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- programs/regedit/regedit.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/programs/regedit/regedit.c b/programs/regedit/regedit.c index acff701..2cbd4bb 100644 --- a/programs/regedit/regedit.c +++ b/programs/regedit/regedit.c @@ -105,8 +105,8 @@ static void get_file_name(CHAR **command_line, CHAR *file_name) } } memcpy(file_name, *command_line, pos * sizeof((*command_line)[0])); - /* remove the last backslash */ - if (file_name[pos - 1] == '\\') { + /* Terminate the string and remove the trailing backslash */ + if (pos > 0 && file_name[pos - 1] == '\\') { file_name[pos - 1] = '\0'; } else { file_name[pos] = '\0';