[winpr,stream] Fix Stream_SetPosition return checks

This commit is contained in:
Armin Novak
2026-02-27 20:59:11 +01:00
parent 0f46216a24
commit e6fca2c021
52 changed files with 414 additions and 233 deletions

View File

@@ -176,7 +176,8 @@ static UINT encomsp_recv_filter_updated_pdu(encomspPlugin* encomsp, wStream* s,
if (!Stream_CheckAndLogRequiredLength(TAG, s, (size_t)(body - end)))
return ERROR_INVALID_DATA;
Stream_SetPosition(s, body);
if (!Stream_SetPosition(s, body))
return ERROR_INVALID_DATA;
}
IFCALLRET(context->FilterUpdated, error, context, &pdu);
@@ -237,7 +238,8 @@ static UINT encomsp_recv_application_created_pdu(encomspPlugin* encomsp, wStream
if (!Stream_CheckAndLogRequiredLength(TAG, s, (size_t)(body - end)))
return ERROR_INVALID_DATA;
Stream_SetPosition(s, body);
if (!Stream_SetPosition(s, body))
return ERROR_INVALID_DATA;
}
IFCALLRET(context->ApplicationCreated, error, context, &pdu);
@@ -290,7 +292,8 @@ static UINT encomsp_recv_application_removed_pdu(encomspPlugin* encomsp, wStream
if (!Stream_CheckAndLogRequiredLength(TAG, s, (size_t)(body - end)))
return ERROR_INVALID_DATA;
Stream_SetPosition(s, body);
if (!Stream_SetPosition(s, body))
return ERROR_INVALID_DATA;
}
IFCALLRET(context->ApplicationRemoved, error, context, &pdu);
@@ -352,7 +355,8 @@ static UINT encomsp_recv_window_created_pdu(encomspPlugin* encomsp, wStream* s,
if (!Stream_CheckAndLogRequiredLength(TAG, s, (size_t)(body - end)))
return ERROR_INVALID_DATA;
Stream_SetPosition(s, body);
if (!Stream_SetPosition(s, body))
return ERROR_INVALID_DATA;
}
IFCALLRET(context->WindowCreated, error, context, &pdu);
@@ -405,7 +409,8 @@ static UINT encomsp_recv_window_removed_pdu(encomspPlugin* encomsp, wStream* s,
if (!Stream_CheckAndLogRequiredLength(TAG, s, (size_t)(body - end)))
return ERROR_INVALID_DATA;
Stream_SetPosition(s, body);
if (!Stream_SetPosition(s, body))
return ERROR_INVALID_DATA;
}
IFCALLRET(context->WindowRemoved, error, context, &pdu);
@@ -458,7 +463,8 @@ static UINT encomsp_recv_show_window_pdu(encomspPlugin* encomsp, wStream* s,
if (!Stream_CheckAndLogRequiredLength(TAG, s, (size_t)(body - end)))
return ERROR_INVALID_DATA;
Stream_SetPosition(s, body);
if (!Stream_SetPosition(s, body))
return ERROR_INVALID_DATA;
}
IFCALLRET(context->ShowWindow, error, context, &pdu);
@@ -520,7 +526,8 @@ static UINT encomsp_recv_participant_created_pdu(encomspPlugin* encomsp, wStream
if (!Stream_CheckAndLogRequiredLength(TAG, s, (size_t)(body - end)))
return ERROR_INVALID_DATA;
Stream_SetPosition(s, body);
if (!Stream_SetPosition(s, body))
return ERROR_INVALID_DATA;
}
IFCALLRET(context->ParticipantCreated, error, context, &pdu);
@@ -572,7 +579,8 @@ static UINT encomsp_recv_participant_removed_pdu(encomspPlugin* encomsp, wStream
if (!Stream_CheckAndLogRequiredLength(TAG, s, (size_t)(body - end)))
return ERROR_INVALID_DATA;
Stream_SetPosition(s, body);
if (!Stream_SetPosition(s, body))
return ERROR_INVALID_DATA;
}
IFCALLRET(context->ParticipantRemoved, error, context, &pdu);
@@ -626,7 +634,8 @@ static UINT encomsp_recv_change_participant_control_level_pdu(encomspPlugin* enc
if (!Stream_CheckAndLogRequiredLength(TAG, s, (size_t)(body - end)))
return ERROR_INVALID_DATA;
Stream_SetPosition(s, body);
if (!Stream_SetPosition(s, body))
return ERROR_INVALID_DATA;
}
IFCALLRET(context->ChangeParticipantControlLevel, error, context, &pdu);
@@ -713,7 +722,8 @@ static UINT encomsp_recv_graphics_stream_paused_pdu(encomspPlugin* encomsp, wStr
if (!Stream_CheckAndLogRequiredLength(TAG, s, (size_t)(body - end)))
return ERROR_INVALID_DATA;
Stream_SetPosition(s, body);
if (!Stream_SetPosition(s, body))
return ERROR_INVALID_DATA;
}
IFCALLRET(context->GraphicsStreamPaused, error, context, &pdu);
@@ -762,7 +772,8 @@ static UINT encomsp_recv_graphics_stream_resumed_pdu(encomspPlugin* encomsp, wSt
if (!Stream_CheckAndLogRequiredLength(TAG, s, (size_t)(body - end)))
return ERROR_INVALID_DATA;
Stream_SetPosition(s, body);
if (!Stream_SetPosition(s, body))
return ERROR_INVALID_DATA;
}
IFCALLRET(context->GraphicsStreamResumed, error, context, &pdu);

View File

@@ -84,7 +84,8 @@ static UINT encomsp_recv_change_participant_control_level_pdu(EncomspServerConte
if (!Stream_CheckAndLogRequiredLength(TAG, s, (size_t)((beg + header->Length) - end)))
return ERROR_INVALID_DATA;
Stream_SetPosition(s, (beg + header->Length));
if (!Stream_SetPosition(s, (beg + header->Length)))
return ERROR_INVALID_DATA;
}
IFCALLRET(context->ChangeParticipantControlLevel, error, context, &pdu);