From 37586a7d935b1dfe433429693af9a37005e8fd86 Mon Sep 17 00:00:00 2001 From: Alexander Naumov Date: Fri, 23 Jun 2023 22:14:29 +0200 Subject: [PATCH] fix -Wformat-truncation= screen.c note: 'snprintf' output between 2 and 1026 bytes into a destination of size 1025 --- src/screen.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/screen.c b/src/screen.c index fbed101..fb2ac6c 100644 --- a/src/screen.c +++ b/src/screen.c @@ -928,7 +928,7 @@ int main(int argc, char **argv) *ap = '-'; if (strlen(socknamebuf) > FILENAME_MAX) socknamebuf[FILENAME_MAX - 1] = 0; - snprintf(SocketPath + strlen(SocketPath), sizeof(SocketPath) - strlen(SocketPath) + 1, "/%s", socknamebuf); + snprintf(SocketPath + strlen(SocketPath), sizeof(SocketPath) - strlen(SocketPath) + 2, "/%s", socknamebuf); SET_GUID(); Attacher(); /* NOTREACHED */ @@ -993,7 +993,7 @@ int main(int argc, char **argv) if (strlen(socknamebuf) > FILENAME_MAX) { socknamebuf[FILENAME_MAX] = 0; } - snprintf(SocketPath + strlen(SocketPath), sizeof(SocketPath) - strlen(SocketPath) + 1, "/%s", socknamebuf); + snprintf(SocketPath + strlen(SocketPath), sizeof(SocketPath) - strlen(SocketPath) + 2, "/%s", socknamebuf); ServerSocket = MakeServerSocket(); #ifdef SYSTEM_SCREENRC