Ticket #1282: 0001-Fix-null-pointer-dereference-on-ft-attempts-3.0.x-3.2.x.patch

File 0001-Fix-null-pointer-dereference-on-ft-attempts-3.0.x-3.2.x.patch, 1.4 KB (added by dx, at 2017-01-30T18:15:47Z)
  • protocols/bee_ft.c

    From 865f3f25c1e9b0a107e1b21ac9b110460c19bf4d Mon Sep 17 00:00:00 2001
    From: dequis <dx@dxzone.com.ar>
    Date: Sun, 29 Jan 2017 19:02:22 -0300
    Subject: [PATCH] Fix null pointer dereference on ft attempts from non-existing
     users
    
    This is a backported combination of 701ab81 (included in 3.5) and XXXXXX
    (included in 3.5.1)
    ---
     protocols/bee_ft.c    | 2 +-
     protocols/purple/ft.c | 4 ++++
     2 files changed, 5 insertions(+), 1 deletion(-)
    
    diff --git a/protocols/bee_ft.c b/protocols/bee_ft.c
    index 1026eab3..59bda7ac 100644
    a b file_transfer_t *imcb_file_send_start( struct im_connection *ic, char *handle, c 
    3030        bee_t *bee = ic->bee;
    3131        bee_user_t *bu = bee_user_by_handle( bee, ic, handle );
    3232       
    33         if( bee->ui->ft_in_start )
     33        if( bee->ui->ft_in_start && bu )
    3434                return bee->ui->ft_in_start( bee, bu, file_name, file_size );
    3535        else
    3636                return NULL;
  • protocols/purple/ft.c

    diff --git a/protocols/purple/ft.c b/protocols/purple/ft.c
    index c4efc657..56132ff1 100644
    a b static gboolean prplcb_xfer_new_send_cb( gpointer data, gint fd, b_input_conditi 
    108108        /* TODO(wilmer): After spreading some more const goodness in BitlBee,
    109109           remove the evil cast below. */
    110110        px->ft = imcb_file_send_start( ic, (char*) who, xfer->filename, xfer->size );
     111
     112        if (!px->ft) {
     113                return FALSE;
     114        }
    111115        px->ft->data = px;
    112116       
    113117        px->ft->accept = prpl_xfer_accept;