aboutsummaryrefslogtreecommitdiffstats
path: root/vncviewer
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2025-02-03 12:31:25 +0100
committerPierre Ossman <ossman@cendio.se>2025-02-03 12:52:08 +0100
commit8b2d4048abdf5e0261d4cf8ba0bc9e24bb6255cc (patch)
treede1fdfdd3f61871cab925507ae918d8c6210423b /vncviewer
parent88bcf577d8eba78e34650683579c7b11f5f577b2 (diff)
downloadtigervnc-8b2d4048abdf5e0261d4cf8ba0bc9e24bb6255cc.tar.gz
tigervnc-8b2d4048abdf5e0261d4cf8ba0bc9e24bb6255cc.zip
Silence false truncation warning
We know we won't overflow here, because we've manually truncated the input string already. But gcc can still complain, so we need to shut it up by ignoring the return value.
Diffstat (limited to 'vncviewer')
-rw-r--r--vncviewer/DesktopWindow.cxx7
1 files changed, 5 insertions, 2 deletions
diff --git a/vncviewer/DesktopWindow.cxx b/vncviewer/DesktopWindow.cxx
index ed3abb89..e5933c53 100644
--- a/vncviewer/DesktopWindow.cxx
+++ b/vncviewer/DesktopWindow.cxx
@@ -321,8 +321,11 @@ void DesktopWindow::setName(const char *name)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
- snprintf(windowNameStr, sizeof(windowNameStr),
- labelFormat, truncatedName);
+ if (snprintf(windowNameStr, sizeof(windowNameStr), "%s - TigerVNC",
+ truncatedName) >= (int)sizeof(windowNameStr)) {
+ // This is just to shut up the compiler, as we've already made sure
+ // we won't truncate anything
+ }
#pragma GCC diagnostic pop