From 336aa630a0c219e947afeea6844e09dfe17957e5 Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Wed, 11 Nov 2020 11:31:27 -0500 Subject: [PATCH] [Ada] Address warning compiling terminals.c gcc/ada/ * terminals.c (allocate_pty_desc): Copy one less byte since the last byte will always be set to 0. --- gcc/ada/terminals.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/ada/terminals.c b/gcc/ada/terminals.c index 81388a7771b..ec9db3a6a4c 100644 --- a/gcc/ada/terminals.c +++ b/gcc/ada/terminals.c @@ -1244,7 +1244,7 @@ allocate_pty_desc (pty_desc **desc) { result->slave_fd = slave_fd; /* the string returned by ptsname or _getpty is a static allocated string. So we should make a copy */ - strncpy (result->slave_name, slave_name, sizeof (result->slave_name)); + strncpy (result->slave_name, slave_name, sizeof (result->slave_name) - 1); result->slave_name[sizeof (result->slave_name) - 1] = '\0'; result->child_pid = -1; *desc=result; -- 2.30.2