GUACAMOLE-629: Define constant for maximum blob size.

This commit is contained in:
Michael Jumper 2019-07-30 13:34:24 -07:00
parent c1b8250300
commit c47aa0cea1
5 changed files with 14 additions and 5 deletions

View File

@ -59,7 +59,7 @@ typedef struct guac_jpeg_destination_mgr {
/** /**
* The output buffer. * The output buffer.
*/ */
unsigned char buffer[6048]; unsigned char buffer[GUAC_PROTOCOL_BLOB_MAX_LENGTH];
} guac_jpeg_destination_mgr; } guac_jpeg_destination_mgr;

View File

@ -56,7 +56,7 @@ typedef struct guac_png_write_state {
/** /**
* Buffer of pending PNG data. * Buffer of pending PNG data.
*/ */
char buffer[6048]; char buffer[GUAC_PROTOCOL_BLOB_MAX_LENGTH];
/** /**
* The number of bytes currently stored in the buffer. * The number of bytes currently stored in the buffer.

View File

@ -52,7 +52,7 @@ typedef struct guac_webp_stream_writer {
/** /**
* Buffer of pending WebP data. * Buffer of pending WebP data.
*/ */
char buffer[6048]; char buffer[GUAC_PROTOCOL_BLOB_MAX_LENGTH];
/** /**
* The number of bytes currently stored in the buffer. * The number of bytes currently stored in the buffer.

View File

@ -40,5 +40,14 @@
*/ */
#define GUACAMOLE_PROTOCOL_VERSION "VERSION_1_1_0" #define GUACAMOLE_PROTOCOL_VERSION "VERSION_1_1_0"
/**
* The maximum number of bytes that should be sent in any one blob instruction
* to ensure the instruction does not exceed the maximum allowed instruction
* size.
*
* @see GUAC_INSTRUCTION_MAX_LENGTH
*/
#define GUAC_PROTOCOL_BLOB_MAX_LENGTH 6048
#endif #endif

View File

@ -129,8 +129,8 @@ static void raw_encoder_flush_handler(guac_audio_stream* audio) {
/* Determine size of blob to be written */ /* Determine size of blob to be written */
int chunk_size = remaining; int chunk_size = remaining;
if (chunk_size > 6048) if (chunk_size > GUAC_PROTOCOL_BLOB_MAX_LENGTH)
chunk_size = 6048; chunk_size = GUAC_PROTOCOL_BLOB_MAX_LENGTH;
/* Send audio data */ /* Send audio data */
guac_protocol_send_blob(socket, stream, current, chunk_size); guac_protocol_send_blob(socket, stream, current, chunk_size);