Fixed stream copy in update_message_SurfaceCommand

This commit is contained in:
Armin Novak 2016-02-25 19:37:20 +01:00
parent 16ba8f377d
commit b61ab5ecb7

View File

@ -188,19 +188,12 @@ static BOOL update_message_SurfaceCommand(rdpContext* context, wStream* s)
{ {
wStream* wParam; wStream* wParam;
wParam = (wStream*) malloc(sizeof(wStream)); wParam = Stream_New(NULL, Stream_GetRemainingLength(s));
if (!wParam) if (!wParam)
return FALSE; return FALSE;
wParam->capacity = Stream_Capacity(s); Stream_Copy(wParam, s, Stream_Capacity(s));
wParam->buffer = (BYTE*) malloc(wParam->capacity); Stream_SetPosition(wParam, 0);
if (!wParam->buffer)
{
free(wParam);
return FALSE;
}
wParam->pointer = wParam->buffer;
return MessageQueue_Post(context->update->queue, (void*) context, return MessageQueue_Post(context->update->queue, (void*) context,
MakeMessageId(Update, SurfaceCommand), (void*) wParam, NULL); MakeMessageId(Update, SurfaceCommand), (void*) wParam, NULL);
@ -2058,7 +2051,7 @@ int update_message_free_pointer_update_class(wMessage* msg, int type)
free(wParam); free(wParam);
} }
break; break;
case PointerUpdate_PointerNew: case PointerUpdate_PointerNew:
{ {
POINTER_NEW_UPDATE* wParam = (POINTER_NEW_UPDATE*) msg->wParam; POINTER_NEW_UPDATE* wParam = (POINTER_NEW_UPDATE*) msg->wParam;
@ -2091,11 +2084,11 @@ static int update_message_process_pointer_update_class(rdpUpdateProxy* proxy, wM
break; break;
case PointerUpdate_PointerColor: case PointerUpdate_PointerColor:
IFCALL(proxy->PointerColor, msg->context, (POINTER_COLOR_UPDATE*) msg->wParam); IFCALL(proxy->PointerColor, msg->context, (POINTER_COLOR_UPDATE*) msg->wParam);
break; break;
case PointerUpdate_PointerNew: case PointerUpdate_PointerNew:
IFCALL(proxy->PointerNew, msg->context, (POINTER_NEW_UPDATE*) msg->wParam); IFCALL(proxy->PointerNew, msg->context, (POINTER_NEW_UPDATE*) msg->wParam);
break; break;
case PointerUpdate_PointerCached: case PointerUpdate_PointerCached:
@ -2220,7 +2213,7 @@ int update_message_queue_free_message(wMessage *message)
int msgType; int msgType;
assert(message); assert(message);
if (message->id == WMQ_QUIT) if (message->id == WMQ_QUIT)
return 0; return 0;