mirror of
https://github.com/Tha14/toxic.git
synced 2024-11-25 18:53:02 +01:00
add missing malloc error checks and fix widechar to char comparison
This commit is contained in:
parent
1bbd50aac7
commit
3f02e119f4
@ -716,7 +716,7 @@ static void delete_blocked_friend(uint32_t bnum);
|
||||
/* deactivates delete friend popup and deletes friend if instructed */
|
||||
static void del_friend_deactivate(Tox *m, wint_t key)
|
||||
{
|
||||
if (key == 'y') {
|
||||
if (key == L'y') {
|
||||
if (blocklist_view == 0) {
|
||||
delete_friend(m, PendingDelete.num);
|
||||
sort_friendlist_index();
|
||||
|
@ -153,7 +153,12 @@ static char *extract_socket_path(const char *info)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
path = (char *) malloc(end - pos + 1);
|
||||
path = malloc(end - pos + 1);
|
||||
|
||||
if (path == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
*end = '\0';
|
||||
return strcpy(path, pos);
|
||||
}
|
||||
@ -310,7 +315,12 @@ static int tmux_is_detached(void)
|
||||
session_info_stream = NULL;
|
||||
|
||||
/* prepare search string, for finding the current session's entry */
|
||||
search_str = (char *) malloc(numstr_len + 2);
|
||||
search_str = malloc(numstr_len + 2);
|
||||
|
||||
if (search_str == NULL) {
|
||||
goto fail;
|
||||
}
|
||||
|
||||
search_str[0] = '\n';
|
||||
strcpy(search_str + 1, mplex_data);
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user