← Commit list

7c01bb23bc

Viktor Szakats
Viktor Szakats
2026-02-19
SUCCESS Duration: 623s

Subject

rtspd: fix to check `realloc()` result

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

.clang-tidy.yml+1 -0
@@ -12,5 +12,6 @@ Checks: >-
-clang-analyzer-security.ArrayBound,
-clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling,
-clang-diagnostic-nullability-extension,
+ bugprone-suspicious-realloc-usage,
misc-const-correctness,
portability-*
tests/server/rtspd.c+11 -6
@@ -325,12 +325,17 @@ static int rtspd_ProcessRequest(struct rtspd_httprequest *req)
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.",