rtsp: fixed Session ID comparison to refuse prefix

Closes #6161
This commit is contained in:
Harry Sintonen 2020-11-03 03:36:56 +02:00 committed by Daniel Stenberg
parent 76140ecfde
commit adb0fcfab2
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2

View File

@ -786,9 +786,18 @@ CURLcode Curl_rtsp_parseheader(struct connectdata *conn,
failf(data, "Got a blank Session ID");
}
else if(data->set.str[STRING_RTSP_SESSION_ID]) {
char *end;
size_t idlen;
/* Find the end of Session ID */
end = start + 1;
while(*end && !ISSPACE(*end))
end++;
idlen = end - start;
/* If the Session ID is set, then compare */
if(strncmp(start, data->set.str[STRING_RTSP_SESSION_ID],
strlen(data->set.str[STRING_RTSP_SESSION_ID])) != 0) {
if(strlen(data->set.str[STRING_RTSP_SESSION_ID]) != idlen ||
strncmp(start, data->set.str[STRING_RTSP_SESSION_ID], idlen) != 0) {
failf(data, "Got RTSP Session ID Line [%s], but wanted ID [%s]",
start, data->set.str[STRING_RTSP_SESSION_ID]);
return CURLE_RTSP_SESSION_ERROR;