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

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

    From acb13517556f8a34e5ef3426d686375ddc8d46fd Mon Sep 17 00:00:00 2001
    From: Andreas Mohr <and@gmx.li>
    Date: Sun, 13 Dec 2020 12:50:56 +0000
    Subject: [PATCH] (editcmd.c) fix dereference before null check
    
    Fix dereference before null check
    
    Found by Coverity
    Coverity id #32609
    Coverity id #313667
    
    Signed-off-by: Andreas Mohr <and@gmx.li>
    ---
     src/editor/editcmd.c | 4 ++--
     1 file changed, 2 insertions(+), 2 deletions(-)
    
    diff --git a/src/editor/editcmd.c b/src/editor/editcmd.c
    index 3fec8cd97..27d7bff99 100644
    a b edit_get_match_keyword_cmd (WEdit * edit) 
    35383538        path = ptr; 
    35393539        g_free (tagfile); 
    35403540        tagfile = mc_build_filename (path, TAGS_NAME, (char *) NULL); 
    3541         if (exist_file (tagfile)) 
     3541        if (tagfile != NULL && exist_file (tagfile)) 
    35423542            break; 
    35433543    } 
    35443544    while (strcmp (path, PATH_SEP_STR) != 0); 
    edit_suggest_current_word (WEdit * edit) 
    36303630                    edit_insert (edit, *new_word); 
    36313631                g_free (cp_word); 
    36323632            } 
    3633             else if (retval == B_ADD_WORD && match_word != NULL) 
     3633            else if (retval == B_ADD_WORD) 
    36343634                aspell_add_to_dict (match_word->str, (int) word_len); 
    36353635        } 
    36363636