sudo_rcstr_dup: Fix potential NULL pointer deref

This commit is contained in:
modric
2022-11-22 10:12:29 +08:00
parent 3396267291
commit dbfd84301a

View File

@@ -49,8 +49,10 @@ sudo_rcstr_dup(const char *src)
debug_decl(sudo_rcstr_dup, SUDO_DEBUG_UTIL);
dst = sudo_rcstr_alloc(len);
if (dst != NULL) {
memcpy(dst, src, len);
dst[len] = '\0';
}
debug_return_ptr(dst);
}