GUAC-236: Do not exceed available buffers/layers/streams.
Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/commit/ec2524eb Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/tree/ec2524eb Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/diff/ec2524eb Branch: refs/heads/master Commit: ec2524eb971039a617794bf32e89751a2339c647 Parents: 55f5d1c Author: Michael Jumper <[email protected]> Authored: Wed Mar 16 21:48:21 2016 -0700 Committer: Michael Jumper <[email protected]> Committed: Wed Mar 16 21:48:25 2016 -0700 ---------------------------------------------------------------------- src/guacenc/display-buffers.c | 4 ++-- src/guacenc/display-image-streams.c | 6 +++--- src/guacenc/display-layers.c | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/ec2524eb/src/guacenc/display-buffers.c ---------------------------------------------------------------------- diff --git a/src/guacenc/display-buffers.c b/src/guacenc/display-buffers.c index 5bd68d3..8d230dd 100644 --- a/src/guacenc/display-buffers.c +++ b/src/guacenc/display-buffers.c @@ -37,7 +37,7 @@ guacenc_buffer* guacenc_display_get_buffer(guacenc_display* display, int internal_index = -index - 1; /* Do not lookup / allocate if index is invalid */ - if (internal_index < 0 || internal_index > GUACENC_DISPLAY_MAX_BUFFERS) { + if (internal_index < 0 || internal_index >= GUACENC_DISPLAY_MAX_BUFFERS) { guacenc_log(GUAC_LOG_WARNING, "Buffer index out of bounds: %i", index); return NULL; } @@ -72,7 +72,7 @@ int guacenc_display_free_buffer(guacenc_display* display, int internal_index = -index - 1; /* Do not lookup / free if index is invalid */ - if (internal_index < 0 || internal_index > GUACENC_DISPLAY_MAX_BUFFERS) { + if (internal_index < 0 || internal_index >= GUACENC_DISPLAY_MAX_BUFFERS) { guacenc_log(GUAC_LOG_WARNING, "Buffer index out of bounds: %i", index); return 1; } http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/ec2524eb/src/guacenc/display-image-streams.c ---------------------------------------------------------------------- diff --git a/src/guacenc/display-image-streams.c b/src/guacenc/display-image-streams.c index 46e4b86..e992512 100644 --- a/src/guacenc/display-image-streams.c +++ b/src/guacenc/display-image-streams.c @@ -33,7 +33,7 @@ int guacenc_display_create_image_stream(guacenc_display* display, int index, int mask, int layer_index, const char* mimetype, int x, int y) { /* Do not lookup / allocate if index is invalid */ - if (index < 0 || index > GUACENC_DISPLAY_MAX_STREAMS) { + if (index < 0 || index >= GUACENC_DISPLAY_MAX_STREAMS) { guacenc_log(GUAC_LOG_WARNING, "Stream index out of bounds: %i", index); return 1; } @@ -54,7 +54,7 @@ guacenc_image_stream* guacenc_display_get_image_stream( guacenc_display* display, int index) { /* Do not lookup / allocate if index is invalid */ - if (index < 0 || index > GUACENC_DISPLAY_MAX_STREAMS) { + if (index < 0 || index >= GUACENC_DISPLAY_MAX_STREAMS) { guacenc_log(GUAC_LOG_WARNING, "Stream index out of bounds: %i", index); return NULL; } @@ -67,7 +67,7 @@ guacenc_image_stream* guacenc_display_get_image_stream( int guacenc_display_free_image_stream(guacenc_display* display, int index) { /* Do not lookup / allocate if index is invalid */ - if (index < 0 || index > GUACENC_DISPLAY_MAX_STREAMS) { + if (index < 0 || index >= GUACENC_DISPLAY_MAX_STREAMS) { guacenc_log(GUAC_LOG_WARNING, "Stream index out of bounds: %i", index); return 1; } http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/ec2524eb/src/guacenc/display-layers.c ---------------------------------------------------------------------- diff --git a/src/guacenc/display-layers.c b/src/guacenc/display-layers.c index e0406f8..51b9058 100644 --- a/src/guacenc/display-layers.c +++ b/src/guacenc/display-layers.c @@ -33,7 +33,7 @@ guacenc_layer* guacenc_display_get_layer(guacenc_display* display, int index) { /* Do not lookup / allocate if index is invalid */ - if (index < 0 || index > GUACENC_DISPLAY_MAX_LAYERS) { + if (index < 0 || index >= GUACENC_DISPLAY_MAX_LAYERS) { guacenc_log(GUAC_LOG_WARNING, "Layer index out of bounds: %i", index); return NULL; } @@ -85,7 +85,7 @@ int guacenc_display_free_layer(guacenc_display* display, int index) { /* Do not lookup / free if index is invalid */ - if (index < 0 || index > GUACENC_DISPLAY_MAX_LAYERS) { + if (index < 0 || index >= GUACENC_DISPLAY_MAX_LAYERS) { guacenc_log(GUAC_LOG_WARNING, "Layer index out of bounds: %i", index); return 1; }
