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/gui | |
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/gui')
-rw-r--r-- | apps/gui/icon.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/apps/gui/icon.c b/apps/gui/icon.c index 2c09f88852..9deb1a0c65 100644 --- a/apps/gui/icon.c +++ b/apps/gui/icon.c | |||
@@ -182,7 +182,9 @@ static void load_icons(const char* filename, enum Iconset iconset, | |||
182 | ic->handle = 0; | 182 | ic->handle = 0; |
183 | if (filename[0] && filename[0] != '-') | 183 | if (filename[0] && filename[0] != '-') |
184 | { | 184 | { |
185 | fd = open_pathfmt(O_RDONLY, ICON_DIR "/%s.bmp", filename); | 185 | char fname[MAX_PATH]; |
186 | fd = open_pathfmt(fname, sizeof(fname), O_RDONLY, | ||
187 | ICON_DIR "/%s.bmp", filename); | ||
186 | if (fd < 0) | 188 | if (fd < 0) |
187 | return; | 189 | return; |
188 | buf_size = read_bmp_fd(fd, &ic->bmp, 0, | 190 | buf_size = read_bmp_fd(fd, &ic->bmp, 0, |