Skip to content

Commit

Permalink
cursor: put an upper bound on the cursor shape size
Browse files Browse the repository at this point in the history
  • Loading branch information
gnif committed Nov 11, 2023
1 parent 7fc35cf commit fe62103
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/channel_cursor.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,13 @@ static struct PSCursorImage * convertCursor(SpiceCursor * cursor)
if (cursor->flags & SPICE_CURSOR_FLAGS_FROM_CACHE)
return loadCursor(cursor->header.unique);

if (cursor->header.width > 512 || cursor->header.height > 512)
{
PS_LOG_ERROR("Unexpected cursor size: %ux%u",
cursor->header.width, cursor->header.height);
return NULL;
}

size_t bufferSize = cursorBufferSize(&cursor->header);
struct PSCursorImage * node = malloc(sizeof(struct PSCursorImage) + bufferSize);

Expand Down

0 comments on commit fe62103

Please sign in to comment.