1
0
mirror of https://github.com/fluencelabs/redis synced 2025-04-02 15:51:05 +00:00

Streams: fix xreadGetKeys() buffer overflow.

The loop allocated a buffer for the right number of keys positions, then
overflowed it going past the limit.

Related to  and cause of the memory violation seen in .
This commit is contained in:
antirez 2018-06-18 13:51:19 +02:00
parent 62f9ac6f43
commit a0b27dae85

@ -1422,7 +1422,7 @@ int *xreadGetKeys(struct redisCommand *cmd, robj **argv, int argc, int *numkeys)
there are also the IDs, one per key. */ there are also the IDs, one per key. */
keys = zmalloc(sizeof(int) * num); keys = zmalloc(sizeof(int) * num);
for (i = streams_pos+1; i < argc; i++) keys[i-streams_pos-1] = i; for (i = streams_pos+1; i < argc-num; i++) keys[i-streams_pos-1] = i;
*numkeys = num; *numkeys = num;
return keys; return keys;
} }