diff options
author | William Wilgus <wilgus.william@gmail.com> | 2022-11-23 21:46:13 -0500 |
---|---|---|
committer | William Wilgus <wilgus.william@gmail.com> | 2022-11-23 22:09:46 -0500 |
commit | 3745c813f924b12232c4f37610aecd23fe5654b8 (patch) | |
tree | 41069cc3f39c61b7d0611877d4251827be6cd2e1 /apps/filetypes.c | |
parent | 80b8b13544c79f57bf7da6320cee5d76c162e96c (diff) | |
download | rockbox-3745c813f924b12232c4f37610aecd23fe5654b8.tar.gz rockbox-3745c813f924b12232c4f37610aecd23fe5654b8.zip |
misc.c open_pathfmt caller supplied buffer
Amachronic raised concern about open() blocking causing a static buf
to get overwritten in multiple calls its prudent to just have the caller
supply the buffer to minimize stack issues later
Change-Id: Iae27c7d063adb1a65688f920f6aa5c395fa5694a
Diffstat (limited to 'apps/filetypes.c')
-rw-r--r-- | apps/filetypes.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/apps/filetypes.c b/apps/filetypes.c index d690b554fd..ec9bd1a7ae 100644 --- a/apps/filetypes.c +++ b/apps/filetypes.c | |||
@@ -325,8 +325,8 @@ void read_color_theme_file(void) { | |||
325 | if (!global_settings.colors_file[0] || global_settings.colors_file[0] == '-') | 325 | if (!global_settings.colors_file[0] || global_settings.colors_file[0] == '-') |
326 | return; | 326 | return; |
327 | 327 | ||
328 | fd = open_pathfmt(O_RDONLY, THEME_DIR "/%s.colours", | 328 | fd = open_pathfmt(buffer, sizeof(buffer), O_RDONLY, |
329 | global_settings.colors_file); | 329 | THEME_DIR "/%s.colours", global_settings.colors_file); |
330 | if (fd < 0) | 330 | if (fd < 0) |
331 | return; | 331 | return; |
332 | while (read_line(fd, buffer, MAX_PATH) > 0) | 332 | while (read_line(fd, buffer, MAX_PATH) > 0) |
@@ -365,10 +365,11 @@ void read_viewer_theme_file(void) | |||
365 | custom_filetype_icons[i] = filetypes[i].icon; | 365 | custom_filetype_icons[i] = filetypes[i].icon; |
366 | } | 366 | } |
367 | 367 | ||
368 | fd = open_pathfmt(O_RDONLY, "%s/%s.icons", ICON_DIR, | 368 | fd = open_pathfmt(buffer, sizeof(buffer), O_RDONLY, |
369 | global_settings.viewers_icon_file); | 369 | ICON_DIR "/%s.icons", global_settings.viewers_icon_file); |
370 | if (fd < 0) | 370 | if (fd < 0) |
371 | return; | 371 | return; |
372 | |||
372 | while (read_line(fd, buffer, MAX_PATH) > 0) | 373 | while (read_line(fd, buffer, MAX_PATH) > 0) |
373 | { | 374 | { |
374 | if (!settings_parseline(buffer, &ext, &icon)) | 375 | if (!settings_parseline(buffer, &ext, &icon)) |