mirror of
https://github.com/Tha14/toxic.git
synced 2025-02-17 04:47:24 +01:00
fix possible buffer overflow
This commit is contained in:
parent
9fe75fbc47
commit
618b731d5a
@ -93,6 +93,7 @@ void exit_toxic_success(Tox *m)
|
|||||||
kill_all_windows();
|
kill_all_windows();
|
||||||
|
|
||||||
free(DATA_FILE);
|
free(DATA_FILE);
|
||||||
|
free(BLOCK_FILE);
|
||||||
free(user_settings_);
|
free(user_settings_);
|
||||||
|
|
||||||
#ifdef _SOUND_NOTIFY
|
#ifdef _SOUND_NOTIFY
|
||||||
@ -523,11 +524,12 @@ static void parse_args(int argc, char *argv[])
|
|||||||
switch (opt) {
|
switch (opt) {
|
||||||
case 'f':
|
case 'f':
|
||||||
DATA_FILE = strdup(optarg);
|
DATA_FILE = strdup(optarg);
|
||||||
BLOCK_FILE = strdup(optarg);
|
BLOCK_FILE = malloc(strlen(optarg) + strlen("-blocklist") + 1);
|
||||||
|
|
||||||
if (DATA_FILE == NULL || BLOCK_FILE == NULL)
|
if (DATA_FILE == NULL || BLOCK_FILE == NULL)
|
||||||
exit_toxic_err("failed in parse_args", FATALERR_MEMORY);
|
exit_toxic_err("failed in parse_args", FATALERR_MEMORY);
|
||||||
|
|
||||||
|
strcpy(BLOCK_FILE, optarg);
|
||||||
strcat(BLOCK_FILE, "-blocklist");
|
strcat(BLOCK_FILE, "-blocklist");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user