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/talk.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/talk.c')
-rw-r--r-- | apps/talk.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/apps/talk.c b/apps/talk.c index 89319ae9a2..c3a1148df4 100644 --- a/apps/talk.c +++ b/apps/talk.c | |||
@@ -247,6 +247,7 @@ static struct buflib_callbacks talk_ops = { | |||
247 | 247 | ||
248 | static int open_voicefile(void) | 248 | static int open_voicefile(void) |
249 | { | 249 | { |
250 | char fname[MAX_PATH]; | ||
250 | char* p_lang = DEFAULT_VOICE_LANG; /* default */ | 251 | char* p_lang = DEFAULT_VOICE_LANG; /* default */ |
251 | 252 | ||
252 | if ( global_settings.lang_file[0] && | 253 | if ( global_settings.lang_file[0] && |
@@ -255,7 +256,8 @@ static int open_voicefile(void) | |||
255 | p_lang = (char *)global_settings.lang_file; | 256 | p_lang = (char *)global_settings.lang_file; |
256 | } | 257 | } |
257 | 258 | ||
258 | return open_pathfmt(O_RDONLY, LANG_DIR "/%s.voice", p_lang); | 259 | return open_pathfmt(fname, sizeof(fname), |
260 | O_RDONLY, LANG_DIR "/%s.voice", p_lang); | ||
259 | } | 261 | } |
260 | 262 | ||
261 | 263 | ||