Ticket #4179: mc-4179-cid-editcmd.c-fix-dereference-before-null-check.patch

File mc-4179-cid-editcmd.c-fix-dereference-before-null-check.patch, 1.2 KB (added by and, 19 months ago)
  • src/editor/editcmd.c

    From 0a34c580e0d2e611a4216358dffb95550650dcd7 Mon Sep 17 00:00:00 2001
    From: Andreas Mohr <and@gmx.li>
    Date: Tue, 18 May 2021 14:34:44 +0000
    Subject: [PATCH] (extfs.c) fix dereference before null check
    
    Fix dereference before null check
    
    Found by Coverity
    Coverity id #110818
    
    Signed-off-by: Andreas Mohr <and@gmx.li>
    ---
     src/editor/editcmd.c | 5 +++--
     1 file changed, 3 insertions(+), 2 deletions(-)
    
    diff --git a/src/editor/editcmd.c b/src/editor/editcmd.c
    index 59ff0e47d..b421c2f36 100644
    a b edit_do_search (WEdit * edit) 
    995995            && !edit_search_options.backwards) 
    996996            edit->search_start++; 
    997997 
    998         if (editcmd_find (&esm, &len)) 
     998        if (edit->search != NULL && editcmd_find (&esm, &len)) 
    999999        { 
    10001000            edit->found_start = edit->search_start = edit->search->normal_offset; 
    10011001            edit->found_len = len; 
    edit_do_search (WEdit * edit) 
    10101010        else 
    10111011        { 
    10121012            edit->search_start = edit->buffer.curs1; 
    1013             edit_show_search_error (edit, _("Search")); 
     1013            if (edit->search != NULL) 
     1014                edit_show_search_error (edit, _("Search")); 
    10141015        } 
    10151016    } 
    10161017