diff options
author | Johannes Hofmann <hofmann@flpsed.org> | 2020-11-12 08:55:49 +0100 |
---|---|---|
committer | Johannes Hofmann <hofmann@flpsed.org> | 2020-11-12 08:55:49 +0100 |
commit | 0087c49f0eb47223ddcc11364a12b484e23830ff (patch) | |
tree | e5d41f0e810ac2cc52285b8ea202fe7f57fd49dc | |
parent | 751890006285f10d7765f64ac473f8534ffe60f8 (diff) |
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
-rw-r--r-- | src/PSEditText.cxx | 4 |
1 files 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); |