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

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

    From 0585d4df64f5eceebb6ed5d3c60ba317b559b2ca Mon Sep 17 00:00:00 2001
    From: Andreas Mohr <and@gmx.li>
    Date: Mon, 21 Dec 2020 09:52:45 +0000
    Subject: [PATCH] (growbuf.c) fix dereference before null check
    
    The NULL check is unnecessary because the pointer can't be NULL
    
    Found by Coverity
    Coverity id #110819
    
    Signed-off-by: Andreas Mohr <and@gmx.li>
    ---
     src/viewer/growbuf.c | 15 ++++++---------
     1 file changed, 6 insertions(+), 9 deletions(-)
    
    diff --git a/src/viewer/growbuf.c b/src/viewer/growbuf.c
    index c1292f255..082e92d27 100644
    a b mcview_growbuf_read_until (WView * view, off_t ofs) 
    205205                    g_free (err_msg); 
    206206                } 
    207207 
    208                 if (view->ds_stdio_pipe != NULL) 
    209                 { 
    210                     /* when switch from parse to raw mode and back, 
    211                      * do not close the already closed pipe after following loop: 
    212                      * mcview_growbuf_read_until() -> mcview_show_error() -> 
    213                      * MSG_DRAW -> mcview_display() -> mcview_get_byte() -> mcview_growbuf_read_until() 
    214                      */ 
    215                     mcview_growbuf_done (view); 
    216                 } 
     208                /* when switch from parse to raw mode and back, 
     209                 * do not close the already closed pipe after following loop: 
     210                 * mcview_growbuf_read_until() -> mcview_show_error() -> 
     211                 * MSG_DRAW -> mcview_display() -> mcview_get_byte() -> mcview_growbuf_read_until() 
     212                 */ 
     213                mcview_growbuf_done (view); 
    217214                mcview_display (view); 
    218215                return; 
    219216            }