Control: forwarded -1 https://github.com/colobot/colobot/pull/1192
Control: tags -1 + patch

Hi,

the attached patch picked from the upstream dev branch fixes this
warning and therefore the build failure.

Kind regards,
  Reiner
diff --git a/debian/patches/gcc8.patch b/debian/patches/gcc8.patch
new file mode 100644
index 0000000..5e0051a
--- /dev/null
+++ b/debian/patches/gcc8.patch
@@ -0,0 +1,32 @@
+From: Jerzy B <chm...@users.noreply.github.com>
+Subject: [PATCH] Fix GCC 8 warning about sprintf overflow (#1192)
+Origin: upstream, https://github.com/colobot/colobot/commit/f3b3062
+Bug-Debian: https://bugs.debian.org/906345
+Bug: https://github.com/colobot/colobot/pull/1192
+
+diff --git a/src/ui/screen/screen_io.cpp b/src/ui/screen/screen_io.cpp
+index 06db03392..d3df8fdbb 100644
+--- a/src/ui/screen/screen_io.cpp
++++ b/src/ui/screen/screen_io.cpp
+@@ -58,7 +58,7 @@ void CScreenIO::IOReadName()
+     CEdit*      pe;
+     std::string resume;
+     char        line[100];
+-    char        name[100];
++    std::string name;
+     time_t      now;
+ 
+     pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
+@@ -81,10 +81,10 @@ void CScreenIO::IOReadName()
+ 
+     time(&now);
+     strftime(line, 99, "%y.%m.%d %H:%M", localtime(&now));
+-    sprintf(name, "%s - %s %d", line, resume.c_str(), m_main->GetLevelRank());
++    name = StrUtils::Format("%s - %s %d", line, resume.c_str(), m_main->GetLevelRank());
+ 
+     pe->SetText(name);
+-    pe->SetCursor(strlen(name), 0);
++    pe->SetCursor(name.length(), 0);
+     m_interface->SetFocus(pe);
+ }
+ 
diff --git a/debian/patches/series b/debian/patches/series
index 063fba0..30234f8 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -2,3 +2,4 @@ find-music-in-root-for-multi-source.patch
 oggenc-reproducibly.patch
 doxygen-reproducibly.patch
 build_levelfiles_reproducibly.patch
+gcc8.patch

Attachment: signature.asc
Description: PGP signature

Reply via email to