From 3745c813f924b12232c4f37610aecd23fe5654b8 Mon Sep 17 00:00:00 2001 From: William Wilgus Date: Wed, 23 Nov 2022 21:46:13 -0500 Subject: 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 --- apps/gui/icon.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'apps/gui/icon.c') 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, ic->handle = 0; if (filename[0] && filename[0] != '-') { - fd = open_pathfmt(O_RDONLY, ICON_DIR "/%s.bmp", filename); + char fname[MAX_PATH]; + fd = open_pathfmt(fname, sizeof(fname), O_RDONLY, + ICON_DIR "/%s.bmp", filename); if (fd < 0) return; buf_size = read_bmp_fd(fd, &ic->bmp, 0, -- cgit v1.2.3