summaryrefslogtreecommitdiffstats
path: root/debian/patches/0001-Fix-gcc8-snprintf-truncation-warning.patch
blob: 156664708bc2697bd4840b6f1684db37a3c88b68 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
From 2a5b5410b2a96d656544803809de109f474901f2 Mon Sep 17 00:00:00 2001
From: John Hood <cgull@glup.org>
Date: Wed, 11 Apr 2018 18:10:59 -0400
Subject: Fix gcc8 snprintf truncation warning.

---
 src/frontend/mosh-server.cc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/frontend/mosh-server.cc b/src/frontend/mosh-server.cc
index 7918c74..567252f 100644
--- a/src/frontend/mosh-server.cc
+++ b/src/frontend/mosh-server.cc
@@ -764,8 +764,8 @@ static void serve( int host_fd, Terminal
 	      throw NetworkException( std::string( "serve: getnameinfo: " ) + gai_strerror( errcode ), 0 );
 	    }
 
-	    char tmp[ 64 ];
-	    snprintf( tmp, 64, "%s via mosh [%d]", host, getpid() );
+	    char tmp[ 64 + NI_MAXHOST ];
+	    snprintf( tmp, 64 + NI_MAXHOST, "%s via mosh [%d]", host, getpid() );
 	    utempter_add_record( host_fd, tmp );
 
 	    connected_utmp = true;