err: fix coverity dereference after null check
@@ -92,6 +92,7 @@ void ERR_vset_error(int lib, int reason, const char *fmt, va_list args)
}
if (printed_len < 0)
printed_len = 0;
+ if (buf != NULL)
buf[printed_len] = '\0';
/*
@@ -103,6 +104,7 @@ void ERR_vset_error(int lib, int reason, const char *fmt, va_list args)
if ((rbuf = OPENSSL_realloc(buf, printed_len + 1)) != NULL) {
buf = rbuf;
buf_size = printed_len + 1;
+ buf[printed_len] = '\0';
}
if (buf != NULL)
