From b1f79b9d35a7d9b1ce2f782714020f14ce78b561 Mon Sep 17 00:00:00 2001 From: Will Song Date: Mon, 12 Jan 2015 22:51:00 -0600 Subject: [PATCH] add a memory check just in case --- src/command/commands.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/command/commands.c b/src/command/commands.c index b1a829b5..d6a8af2f 100644 --- a/src/command/commands.c +++ b/src/command/commands.c @@ -137,6 +137,10 @@ cmd_connect(gchar **args, struct cmd_help_t help) if(stream){ // Limit to READ_BUF_SIZE bytes to prevent overflows in the case of a poorly chosen command account->password = g_malloc(READ_BUF_SIZE); + if(!account->password){ + log_error("Failed to allocate enough memory to read eval_password output"); + return TRUE; + } account->password = fgets(account->password, READ_BUF_SIZE, stream); pclose(stream); } else {