From 3ac66ce0229e35340c86a64a1ceae949ecb0239a Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Thu, 23 Nov 2017 10:12:34 +0100 Subject: [PATCH] Fix potentially ambiguous printf() Not a real issue, since it's just supposed to be some unique number. but still. Reported by PVS-Studio - https://www.viva64.com/en/b/0540/ --- gtk2_ardour/luawindow.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gtk2_ardour/luawindow.cc b/gtk2_ardour/luawindow.cc index 89a1d387aa..4e02cd2b20 100644 --- a/gtk2_ardour/luawindow.cc +++ b/gtk2_ardour/luawindow.cc @@ -483,11 +483,12 @@ LuaWindow::save_script () // 5) construct filename -- TODO ask user for name, ask to replace file. do { + char tme[80]; char buf[80]; time_t t = time(0); struct tm * timeinfo = localtime (&t); - strftime (buf, sizeof(buf), "%s%d", timeinfo); - sprintf (buf, "%s%ld", buf, random ()); // is this valid? + strftime (tme, sizeof(tme), "%s", timeinfo); + snprintf (buf, sizeof(buf), "%s%ld", tme, random ()); MD5 md5; std::string fn = md5.digestString (buf);