about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorWill Song <incertia9474@gmail.com>2015-01-12 22:51:00 -0600
committerWill Song <incertia9474@gmail.com>2015-01-12 22:51:00 -0600
commitb1f79b9d35a7d9b1ce2f782714020f14ce78b561 (patch)
tree4c71a34a912c4e5e05638b2a524980fd6820636c
parentb6536ddf88f1261f8a799e52aa0db020334489f4 (diff)
downloadprofani-tty-b1f79b9d35a7d9b1ce2f782714020f14ce78b561.tar.gz
add a memory check just in case
-rw-r--r--src/command/commands.c4
1 files changed, 4 insertions, 0 deletions
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 {