about summary refs log tree commit diff stats
path: root/src/command
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2015-01-14 00:35:31 +0000
committerJames Booth <boothj5@gmail.com>2015-01-14 00:35:31 +0000
commite19d57779f9a0d89f47b6bbdcdd20fbdc5083e6a (patch)
treeeb062e0db3e7ce875de60713531233f57c5e844b /src/command
parente79302bf0e8856a987a19f573d785e1f4c1736e0 (diff)
downloadprofani-tty-e19d57779f9a0d89f47b6bbdcdd20fbdc5083e6a.tar.gz
Fixed segfault on eval_password due to moving popen call
Diffstat (limited to 'src/command')
-rw-r--r--src/command/commands.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/command/commands.c b/src/command/commands.c
index 2f61b6fa..012d5fb7 100644
--- a/src/command/commands.c
+++ b/src/command/commands.c
@@ -141,12 +141,20 @@ cmd_connect(gchar **args, struct cmd_help_t help)
                     account->password = g_malloc(READ_BUF_SIZE);
                     if(!account->password){
                         log_error("Failed to allocate enough memory to read eval_password output");
+                        cons_show("Error evaluating password, see logs for details.");
                         return TRUE;
                     }
                     account->password = fgets(account->password, READ_BUF_SIZE, stream);
                     pclose(stream);
+                    if(!account->password){
+                        log_error("No result from eval_password.");
+                        cons_show("Error evaluating password, see logs for details.");
+                        return TRUE;
+                    }
                 } else {
                     log_error("popen failed when running eval_password.");
+                    cons_show("Error evaluating password, see logs for details.");
+                    return TRUE;
                 }
                 g_string_free(cmd, TRUE);
             } else if (!account->password) {