1
0
mirror of https://github.com/Tha14/toxic.git synced 2025-07-03 01:06:44 +02:00

add missing malloc error checks and fix widechar to char comparison

This commit is contained in:
jfreegman
2020-11-03 00:59:28 -05:00
parent 1bbd50aac7
commit 3f02e119f4
3 changed files with 20 additions and 5 deletions

View File

@ -429,12 +429,17 @@ static int password_prompt(char *buf, int size)
}
const char *p = fgets(buf, size, stdin);
int len = strlen(buf);
/* re-enable terminal echo */
tcsetattr(fileno(stdin), TCSANOW, &oflags);
if (p == NULL || len <= 1) {
if (p == NULL) {
return 0;
}
size_t len = strlen(buf);
if (len <= 1) {
return 0;
}