1
0
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:
Luigi Pinca
2012-09-15 22:29:47 +02:00
committed by DTrejo
parent 1dbe587fca
commit f03e673338

View File

@@ -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);
}