1
0
mirror of https://gittea.dev/nova/th.git synced 2025-12-09 09:10:10 -05:00

fixed wrong color being saved as a result of improper string size handling

This commit is contained in:
nova
2025-11-03 19:44:20 +01:00
parent 4229ebe1d5
commit 67b99b1cec

4
dir.c
View File

@@ -107,7 +107,7 @@ void get_dir_content(char *path, unsigned long *dir_file_count, file *dir_conten
char *extension = strrchr(entry[i]->d_name, '.');
if (extension) {
for (j = 0; j < color_count; j++) {
if (!strncmp(colors[j].file_extension, extension, strlen(colors[j].file_extension))) {
if (!strcmp(colors[j].file_extension, extension)) {
dir_content[i].color_pair = colors[j].color_pair;
}
}
@@ -130,7 +130,7 @@ void get_dir_content(char *path, unsigned long *dir_file_count, file *dir_conten
char *extension = strrchr(entry[i]->d_name, '.');
if (extension) {
for (j = 0; j < color_count; j++) {
if (!strncmp(colors[j].file_extension, extension, strlen(colors[j].file_extension))) {
if (!strcmp(colors[j].file_extension, extension)) {
dir_content[i].color_pair = colors[j].color_pair;
}
}