You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-06 02:15:48 +03:00
Fix cases where the offset is out of range (javascript parser)
The exception for the "too far" error was not thrown if the offset was bigger than the buffer length, screwing up the parser. Fix #277 Signed-off-by: DTrejo <david.trejo@voxer.com>
This commit is contained in:
@@ -125,12 +125,12 @@ ReplyParser.prototype._parseResult = function (type) {
|
||||
for (i = 0; i < packetHeader.size; i++) {
|
||||
ntype = this._buffer[this._offset++];
|
||||
|
||||
if (this._offset === this._buffer.length) {
|
||||
if (this._offset > this._buffer.length) {
|
||||
throw new Error("too far");
|
||||
}
|
||||
res = this._parseResult(ntype);
|
||||
if (res === undefined) {
|
||||
res = null;
|
||||
res = null;
|
||||
}
|
||||
reply.push(res);
|
||||
}
|
||||
|
Reference in New Issue
Block a user