1
0
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:
Sébastien Helleu
2023-03-19 16:05:03 +01:00
parent 111525792d
commit c7090ae14a
+3 -11
View File
@@ -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;
}