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/talk.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'apps/talk.c') 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 = { static int open_voicefile(void) { + char fname[MAX_PATH]; char* p_lang = DEFAULT_VOICE_LANG; /* default */ if ( global_settings.lang_file[0] && @@ -255,7 +256,8 @@ static int open_voicefile(void) p_lang = (char *)global_settings.lang_file; } - return open_pathfmt(O_RDONLY, LANG_DIR "/%s.voice", p_lang); + return open_pathfmt(fname, sizeof(fname), + O_RDONLY, LANG_DIR "/%s.voice", p_lang); } -- cgit v1.2.3