1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-09-22 19:45:54 -04:00

add a memory check just in case

This commit is contained in:
Will Song 2015-01-12 22:51:00 -06:00
parent b6536ddf88
commit b1f79b9d35
No known key found for this signature in database
GPG Key ID: AF0CA153EA5D9C7C

View File

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