close Warning: Failed to sync with repository "(default)": [Errno 12] Cannot allocate memory; repository information may be out of date. Look in the Trac log for more information including mitigation strategies.

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

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

    From 8fcf15ab04fd9b4786b1d01c148ab8b83400f84d Mon Sep 17 00:00:00 2001
    From: dequis <dx@dxzone.com.ar>
    Date: Sun, 13 Nov 2016 16:52:43 -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 27fd4eac..916b2e88 100644
    a b file_transfer_t *imcb_file_send_start(struct im_connection *ic, char *handle, ch 
    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 320fc887..4d785291 100644
    a b static gboolean prplcb_xfer_new_send_cb(gpointer data, gint fd, b_input_conditio 
    107107        /* TODO(wilmer): After spreading some more const goodness in BitlBee,
    108108           remove the evil cast below. */
    109109        px->ft = imcb_file_send_start(ic, (char *) who, xfer->filename, xfer->size);
     110
     111        if (!px->ft) {
     112                return FALSE;
     113        }
    110114        px->ft->data = px;
    111115
    112116        px->ft->accept = prpl_xfer_accept;