From 0087c49f0eb47223ddcc11364a12b484e23830ff Mon Sep 17 00:00:00 2001 From: Johannes Hofmann Date: Thu, 12 Nov 2020 08:55:49 +0100 Subject: replace strncpy, stncat with strcpy, strcat to avoid compile warning gcc warns "specified bound depends on the length of the source argument". As the buffer has been allocated specifcally to hold src and destination strings there is no point in using strn* functions here. See also: https://stackoverflow.com/questions/56782248/gcc-specified-bound-depends-on-the-length-of-the-source-argument --- src/PSEditText.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/PSEditText.cxx b/src/PSEditText.cxx index bfb5e27..e0729fe 100644 --- a/src/PSEditText.cxx +++ b/src/PSEditText.cxx @@ -41,8 +41,8 @@ void PSEditText::append_text(const char*s1) { int len = (s?strlen(s):0) + strlen(s1) + 1; char *tmp = (char*) malloc(len); - strncpy(tmp, s?s:"", len); - strncat(tmp, s1, len - strlen(tmp)); + strcpy(tmp, s?s:""); + strcat(tmp, s1); if (s) { free(s); -- cgit v1.2.3