Skip to content

Commit

Permalink
fix -Wformat-truncation= screen.c
Browse files Browse the repository at this point in the history
note: 'snprintf' output between 2 and 1026 bytes into a destination
of size 1025
  • Loading branch information
alexander-naumov committed May 30, 2024
1 parent 0a379ad commit 37586a7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/screen.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 37586a7

Please sign in to comment.