Ticket #4103: mc-4103-cid-command.c-fix-out-of-bounds-read.patch

File mc-4103-cid-command.c-fix-out-of-bounds-read.patch, 839 bytes (added by and, 3 years ago)
  • src/filemanager/command.c

    From 9a4b81429255cb4016417d7fd8b5c299010a26a5 Mon Sep 17 00:00:00 2001
    From: Andreas Mohr <and@gmx.li>
    Date: Wed, 9 Dec 2020 16:14:59 +0000
    Subject: [PATCH] (command.c) fix out-of-bounds read
    
    Fix out-of-bounds read
    
    Found by Coverity
    Coverity id #32603
    
    Signed-off-by: Andreas Mohr <and@gmx.li>
    ---
     src/filemanager/command.c | 2 +-
     1 file changed, 1 insertion(+), 1 deletion(-)
    
    diff --git a/src/filemanager/command.c b/src/filemanager/command.c
    index 6202b8020..0c61807c6 100644
    a b do_cd_command (char *orig_cmd) 
    390390    { 
    391391        vfs_path_t *new_vpath = NULL; 
    392392 
    393         if (cmd[0] == '\0') 
     393        if (cmd[CD_OPERAND_OFFSET] == '\0') 
    394394        { 
    395395            new_vpath = vfs_path_from_str (mc_config_get_home_dir ()); 
    396396            sync_tree (new_vpath);