Skip to content

Commit 747a12b

Browse files
committed
Fix potential buffer overflow in trsp_update
1 parent 2ac4e04 commit 747a12b

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

src/trsp-update.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -287,11 +287,10 @@ void trsp_update_files(gchar * input_file)
287287
*key = nx_json_get(json_obj, "mode_id")->int_value;
288288
nmode = g_hash_table_lookup(modes_hash, key);
289289
if (nmode != NULL)
290-
sprintf(m_trsp.mode, "%s", nmode->modname);
290+
g_strlcpy(m_trsp.mode, nmode->modname, sizeof(m_trsp.mode));
291291
else
292-
sprintf(m_trsp.mode, "%lli",
293-
nx_json_get(json_obj,
294-
"mode_id")->int_value);
292+
g_snprintf(m_trsp.mode, sizeof(m_trsp.mode), "%lli",
293+
nx_json_get(json_obj, "mode_id")->int_value);
295294

296295
m_trsp.invert =
297296
nx_json_get(json_obj, "invert")->int_value;

0 commit comments

Comments
 (0)