[PATCH] Cygwin: Fix size of a buffer in the ps utility
Jon Turney
jon.turney@dronecode.org.uk
Wed Feb 26 20:08:00 GMT 2020
Fix the size of a temporary buffer used in the ps utility, reported as a
new warning by gcc-9.2.0
../../../../src/winsup/utils/ps.cc: In function 'const char* ttynam(int)':
../../../../src/winsup/utils/ps.cc:101:23: warning: 'sprintf' may write a terminating nul past the end of the destination [-Wformat-overflow=]
../../../../src/winsup/utils/ps.cc:101:11: note: 'sprintf' output between 9 and 10 bytes into a destination of size 9
---
winsup/utils/ps.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/winsup/utils/ps.cc b/winsup/utils/ps.cc
index 2307f7955..63b92319e 100644
--- a/winsup/utils/ps.cc
+++ b/winsup/utils/ps.cc
@@ -90,7 +90,7 @@ to_time_t (FILETIME *ptr)
static const char *
ttynam (int ntty)
{
- static char buf[9];
+ static char buf[10];
char buf0[9];
if (ntty < 0)
strcpy (buf0, "?");
--
2.21.0
More information about the Cygwin-patches
mailing list