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)
char *b = strerror_r(err, buf, buflen);
if (b != buf) {
strncpy(buf, b, buflen);
buf[buflen - 1] = '\0';
malloc_snprintf(buf, buflen, "%s", b);
}
return 0;
#else