Correct payload-length when parsing RTSP Messages

This commit is contained in:
loki 2020-01-11 14:57:55 +01:00
parent e60a7ef75f
commit bb004e8cb2

View File

@ -210,11 +210,11 @@ int parseRtspMessage(PRTSP_MESSAGE msg, char* rtspMessage, int length) {
// Package the new parsed message into the struct // Package the new parsed message into the struct
if (flag == TYPE_REQUEST) { if (flag == TYPE_REQUEST) {
createRtspRequest(msg, messageBuffer, FLAG_ALLOCATED_MESSAGE_BUFFER | FLAG_ALLOCATED_OPTION_ITEMS, command, target, createRtspRequest(msg, messageBuffer, FLAG_ALLOCATED_MESSAGE_BUFFER | FLAG_ALLOCATED_OPTION_ITEMS, command, target,
protocol, sequenceNum, options, payload, payload ? length - (int)(messageBuffer - payload) : 0); protocol, sequenceNum, options, payload, payload ? length - (int)(payload - messageBuffer) : 0);
} }
else { else {
createRtspResponse(msg, messageBuffer, FLAG_ALLOCATED_MESSAGE_BUFFER | FLAG_ALLOCATED_OPTION_ITEMS, protocol, statusCode, createRtspResponse(msg, messageBuffer, FLAG_ALLOCATED_MESSAGE_BUFFER | FLAG_ALLOCATED_OPTION_ITEMS, protocol, statusCode,
statusStr, sequenceNum, options, payload, payload ? length - (int)(messageBuffer - payload) : 0); statusStr, sequenceNum, options, payload, payload ? length - (int)(payload - messageBuffer) : 0);
} }
return RTSP_ERROR_SUCCESS; return RTSP_ERROR_SUCCESS;