Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/lib/editorconfig.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ static int array_editorconfig_name_value_add(
int name_value_pos;
/* always use name_lwr but not name, since property names are case
* insensitive */
char name_lwr[MAX_PROPERTY_NAME];
char name_lwr[MAX_PROPERTY_NAME+1] = {0};
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a point that I missed in the original implementation. Thanks!

/* For the first time we came here, aenv->name_values is NULL */
if (aenv->name_values == NULL) {
aenv->name_values = (editorconfig_name_value*)malloc(
Expand All @@ -153,7 +153,7 @@ static int array_editorconfig_name_value_add(


/* name_lwr is the lowercase property name */
strlwr(strcpy(name_lwr, name));
strlwr(strncpy(name_lwr, name, MAX_PROPERTY_NAME));

name_value_pos = find_name_value_from_name(
aenv->name_values, aenv->current_value_count, name_lwr);
Expand Down