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 */
|
/* deactivates delete friend popup and deletes friend if instructed */
|
||||||
static void del_friend_deactivate(Tox *m, wint_t key)
|
static void del_friend_deactivate(Tox *m, wint_t key)
|
||||||
{
|
{
|
||||||
if (key == 'y') {
|
if (key == L'y') {
|
||||||
if (blocklist_view == 0) {
|
if (blocklist_view == 0) {
|
||||||
delete_friend(m, PendingDelete.num);
|
delete_friend(m, PendingDelete.num);
|
||||||
sort_friendlist_index();
|
sort_friendlist_index();
|
||||||
|
@ -153,7 +153,12 @@ static char *extract_socket_path(const char *info)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
path = (char *) malloc(end - pos + 1);
|
path = malloc(end - pos + 1);
|
||||||
|
|
||||||
|
if (path == NULL) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
*end = '\0';
|
*end = '\0';
|
||||||
return strcpy(path, pos);
|
return strcpy(path, pos);
|
||||||
}
|
}
|
||||||
@ -310,7 +315,12 @@ static int tmux_is_detached(void)
|
|||||||
session_info_stream = NULL;
|
session_info_stream = NULL;
|
||||||
|
|
||||||
/* prepare search string, for finding the current session's entry */
|
/* 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';
|
search_str[0] = '\n';
|
||||||
strcpy(search_str + 1, mplex_data);
|
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);
|
const char *p = fgets(buf, size, stdin);
|
||||||
int len = strlen(buf);
|
|
||||||
|
|
||||||
/* re-enable terminal echo */
|
/* re-enable terminal echo */
|
||||||
tcsetattr(fileno(stdin), TCSANOW, &oflags);
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user