From: Arnaud Charlet Date: Wed, 11 Nov 2020 16:31:27 +0000 (-0500) Subject: [Ada] Address warning compiling terminals.c X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=336aa630a0c219e947afeea6844e09dfe17957e5;p=gcc.git [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. --- 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;