From 335ab22a553cc47b1b2acb95c3899e4bcea7ac36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Sun, 30 Oct 2016 07:07:29 +0100 Subject: [PATCH] xfer: add check on filename2 allocation Now string_expand_home() can return NULL if the HOME environment variable it not set, so this commit adds an extra check on the variable "filename2" before using it. --- src/plugins/xfer/xfer.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/plugins/xfer/xfer.c b/src/plugins/xfer/xfer.c index 7ffd7cf5b..5e3a054ac 100644 --- a/src/plugins/xfer/xfer.c +++ b/src/plugins/xfer/xfer.c @@ -1147,6 +1147,14 @@ xfer_add_cb (const void *pointer, void *data, free (path); } #endif /* _WIN32 */ + if (!filename2) + { + weechat_printf (NULL, + _("%s%s: not enough memory (%s)"), + weechat_prefix ("error"), XFER_PLUGIN_NAME, + "xfer_add, filename2"); + goto error; + } /* check if file exists */ if (stat (filename2, &st) == -1) {