-clang-analyzer-security.ArrayBound,
-clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling,
-clang-diagnostic-nullability-extension,
+ bugprone-suspicious-realloc-usage,
misc-const-correctness,
portability-*
req->rtp_buffersize = rtp_size + 4;
}
else {
- req->rtp_buffer = realloc(req->rtp_buffer,
- req->rtp_buffersize +
- rtp_size + 4);
- memcpy(req->rtp_buffer + req->rtp_buffersize, rtp_scratch,
- rtp_size + 4);
- req->rtp_buffersize += rtp_size + 4;
+ char *rtp_buffer = realloc(req->rtp_buffer,
+ req->rtp_buffersize +
+ rtp_size + 4);
+ if(rtp_buffer) {
+ req->rtp_buffer = rtp_buffer;
+ memcpy(req->rtp_buffer + req->rtp_buffersize, rtp_scratch,
+ rtp_size + 4);
+ req->rtp_buffersize += rtp_size + 4;
+ }
+ else
+ logmsg("failed resizing buffer.");
free(rtp_scratch);
}
logmsg("rtp_buffersize is %zu, rtp_size is %d.",