From 595b85cd068f837cfb945e386b72c3b55234b969 Mon Sep 17 00:00:00 2001
From: Marko Lindqvist <cazfi74@gmail.com>
Date: Wed, 20 Apr 2022 20:35:29 +0300
Subject: [PATCH 53/53] Qt: Make sure player count string in server list gets
 terminated

- Increase the buffer size to 35
- Add termination of the string in case translation of "Unknown"
  still doesn't fit

See osdn #44421

Signed-off-by: Marko Lindqvist <cazfi74@gmail.com>
---
 client/gui-qt/pages.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/client/gui-qt/pages.cpp b/client/gui-qt/pages.cpp
index 6da3c0ee15..44b74720c6 100644
--- a/client/gui-qt/pages.cpp
+++ b/client/gui-qt/pages.cpp
@@ -900,7 +900,7 @@ void fc_client::update_server_list(enum server_scan_type sstype,
   sel->clearContents();
   row = 0;
   server_list_iterate(list, pserver) {
-    char buf[20];
+    char buf[35];
     int tmp;
     QString tstring;
 
@@ -912,6 +912,7 @@ void fc_client::update_server_list(enum server_scan_type sstype,
       fc_snprintf(buf, sizeof(buf), "%d", pserver->humans);
     } else {
       strncpy(buf, _("Unknown"), sizeof(buf) - 1);
+      buf[sizeof(buf) - 1] = '\0';
     }
 
     tmp = pserver->port;
-- 
2.35.1