mirror of
https://github.com/weechat/weechat.git
synced 2026-07-04 21:25:41 +02:00
Secured code to prevent buffer overflows and memory leaks
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -291,7 +291,7 @@ gui_window_free (t_gui_window *window)
|
||||
|
||||
/* always at least one window */
|
||||
if (!gui_windows && create_new)
|
||||
gui_window_new (NULL, NULL, 1);
|
||||
(void) gui_window_new (NULL, NULL, 1);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
+82
-61
File diff suppressed because it is too large
Load Diff
@@ -56,15 +56,17 @@ t_plugin_handler *last_plugin_cmd_handler = NULL;
|
||||
void
|
||||
plugin_auto_load (int plugin_type, char *directory)
|
||||
{
|
||||
int dir_length;
|
||||
char *dir_name, *current_dir;
|
||||
DIR *dir;
|
||||
struct dirent *entry;
|
||||
struct stat statbuf;
|
||||
|
||||
/* build directory, adding WeeChat home */
|
||||
dir_length = strlen (weechat_home) + strlen (directory) + 2;
|
||||
dir_name =
|
||||
(char *) malloc ((strlen (weechat_home) + strlen (directory) + 2) * sizeof (char));
|
||||
sprintf (dir_name, "%s%s%s", weechat_home, DIR_SEPARATOR, directory);
|
||||
(char *) malloc (dir_length * sizeof (char));
|
||||
snprintf (dir_name, dir_length, "%s%s%s", weechat_home, DIR_SEPARATOR, directory);
|
||||
|
||||
/* save working directory */
|
||||
current_dir = (char *) malloc (1024 * sizeof (char));
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -291,7 +291,7 @@ gui_window_free (t_gui_window *window)
|
||||
|
||||
/* always at least one window */
|
||||
if (!gui_windows && create_new)
|
||||
gui_window_new (NULL, NULL, 1);
|
||||
(void) gui_window_new (NULL, NULL, 1);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -56,15 +56,17 @@ t_plugin_handler *last_plugin_cmd_handler = NULL;
|
||||
void
|
||||
plugin_auto_load (int plugin_type, char *directory)
|
||||
{
|
||||
int dir_length;
|
||||
char *dir_name, *current_dir;
|
||||
DIR *dir;
|
||||
struct dirent *entry;
|
||||
struct stat statbuf;
|
||||
|
||||
/* build directory, adding WeeChat home */
|
||||
dir_length = strlen (weechat_home) + strlen (directory) + 2;
|
||||
dir_name =
|
||||
(char *) malloc ((strlen (weechat_home) + strlen (directory) + 2) * sizeof (char));
|
||||
sprintf (dir_name, "%s%s%s", weechat_home, DIR_SEPARATOR, directory);
|
||||
(char *) malloc (dir_length * sizeof (char));
|
||||
snprintf (dir_name, dir_length, "%s%s%s", weechat_home, DIR_SEPARATOR, directory);
|
||||
|
||||
/* save working directory */
|
||||
current_dir = (char *) malloc (1024 * sizeof (char));
|
||||
|
||||
Reference in New Issue
Block a user