Fix string handling

This commit is contained in:
Suvendhu Hansa 2025-08-22 17:31:29 +05:30 committed by Vivek Dutta
parent 42d1e14a91
commit 97320a95ab

View file

@ -317,13 +317,18 @@ void free_dmmap_config_dup_list(struct list_head *dup_list)
struct uci_section *get_config_section_from_dmmap_section_name(const char *config_sec_name)
{
if (DM_STRLEN(config_sec_name) == 0)
int len = DM_STRLEN(config_sec_name);
if (len == 0)
return NULL;
char *p = strchr(config_sec_name, '.');
char tmp[len + 1];
snprintf(tmp, sizeof(tmp), "%s", config_sec_name);
char *p = strchr(tmp, '.');
if (p) *p = 0;
return dmuci_get_section(config_sec_name, p ? p + 1 : "");
return dmuci_get_section(tmp, p ? p + 1 : "");
}
struct uci_section *get_origin_section_from_config(const char *package, const char *section_type, const char *orig_section_name)