mirror of
https://github.com/weechat/weechat.git
synced 2026-06-12 14:14:48 +02:00
core: use a fixed size buffer to create a bar option
This commit is contained in:
+3
-11
@@ -1311,18 +1311,12 @@ struct t_config_option *
|
||||
gui_bar_create_option (const char *bar_name, int index_option, const char *value)
|
||||
{
|
||||
struct t_config_option *ptr_option;
|
||||
int length;
|
||||
char *option_name;
|
||||
char option_name[4096];
|
||||
|
||||
ptr_option = NULL;
|
||||
|
||||
length = strlen (bar_name) + 1 +
|
||||
strlen (gui_bar_option_string[index_option]) + 1;
|
||||
option_name = malloc (length);
|
||||
if (!option_name)
|
||||
return NULL;
|
||||
|
||||
snprintf (option_name, length, "%s.%s",
|
||||
snprintf (option_name, sizeof (option_name),
|
||||
"%s.%s",
|
||||
bar_name, gui_bar_option_string[index_option]);
|
||||
|
||||
switch (index_option)
|
||||
@@ -1499,8 +1493,6 @@ gui_bar_create_option (const char *bar_name, int index_option, const char *value
|
||||
break;
|
||||
}
|
||||
|
||||
free (option_name);
|
||||
|
||||
return ptr_option;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user