1
0
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:
Sebastien Helleu
2004-01-24 12:59:57 +00:00
parent dcb3b6fc7e
commit 8bcbc3dcae
8 changed files with 210 additions and 158 deletions
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -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
View File
File diff suppressed because it is too large Load Diff
+4 -2
View File
@@ -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
+1 -1
View File
@@ -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
+4 -2
View File
@@ -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));