regedit: Fix an out-of-bounds array access (clang).

Signed-off-by: Kirill K. Smirnov <kirill.k.smirnov@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Kirill Smirnov 2016-05-09 19:50:44 +03:00 committed by Alexandre Julliard
parent 0adf2af7ff
commit fe517f9256
1 changed files with 2 additions and 2 deletions

View File

@ -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';