1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-11-03 19:37:16 -05:00

Fixed segfault on eval_password due to moving popen call

This commit is contained in:
James Booth 2015-01-14 00:35:31 +00:00
parent e79302bf0e
commit e19d57779f

View File

@ -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) {