mirror of
https://gittea.dev/nova/th.git
synced 2026-01-30 08:40:10 -05:00
fixed wrong color being saved as a result of improper string size handling
This commit is contained in:
4
dir.c
4
dir.c
@@ -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, '.');
|
char *extension = strrchr(entry[i]->d_name, '.');
|
||||||
if (extension) {
|
if (extension) {
|
||||||
for (j = 0; j < color_count; j++) {
|
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;
|
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, '.');
|
char *extension = strrchr(entry[i]->d_name, '.');
|
||||||
if (extension) {
|
if (extension) {
|
||||||
for (j = 0; j < color_count; j++) {
|
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;
|
dir_content[i].color_pair = colors[j].color_pair;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user