necouchman commented on a change in pull request #274:
URL: https://github.com/apache/guacamole-server/pull/274#discussion_r420391730



##########
File path: src/protocols/rdp/plugins/guacai/guacai-messages.c
##########
@@ -48,8 +52,9 @@ static void guac_rdp_ai_read_format(wStream* stream,
     Stream_Read_UINT16(stream, format->bps); /* wBitsPerSample */
     Stream_Read_UINT16(stream, format->data_size); /* cbSize */
 
-    /* Read arbitrary data block (if applicable) */
-    if (format->data_size != 0) {
+    /* Read arbitrary data block (if applicable) and data is available. */
+    if (format->data_size != 0
+            && Stream_GetRemainingLength(stream) >= format->data_size) {

Review comment:
       Okay, took a stab at changing this such that any errors in 
`guac_rdp_ai_read_format()` results in `guac_rdp_ai_process_formats()` bailing 
out without continuing trying to process formats.  Let me know if that needs 
any work.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to