Avoid strncpy in malloc_strcpy

Signed-off-by: orbisai0security <>
This commit is contained in:
orbisai0security
2026-05-02 14:40:20 +05:30
committed by Guangli Dai
parent be2de8ccd8
commit 1ffd5e96d6

View File

@@ -105,8 +105,7 @@ buferror(int err, char *buf, size_t buflen) {
&& defined(_GNU_SOURCE) && defined(_GNU_SOURCE)
char *b = strerror_r(err, buf, buflen); char *b = strerror_r(err, buf, buflen);
if (b != buf) { if (b != buf) {
strncpy(buf, b, buflen); malloc_snprintf(buf, buflen, "%s", b);
buf[buflen - 1] = '\0';
} }
return 0; return 0;
#else #else