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

Alexandre Julliard julliard at wine.codeweavers.com
Tue May 17 11:19:38 CDT 2016


Module: wine
Branch: master
Commit: fe517f9256e9b9aaa32afb05b01198eec3e5ea17
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=fe517f9256e9b9aaa32afb05b01198eec3e5ea17

Author: Kirill Smirnov <kirill.k.smirnov at 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 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at 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';




More information about the wine-cvs mailing list