Skip to content

Commit

Permalink
don't read past the buffer length
Browse files Browse the repository at this point in the history
  • Loading branch information
sidorares committed Jul 27, 2024
1 parent 51114df commit 7cc06bd
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/packets/packet.js
Original file line number Diff line number Diff line change
Expand Up @@ -610,8 +610,9 @@ class Packet {

parseVector() {
const bufLen = this.readLengthCodedNumber();
const vectorEnd = this.offset + bufLen;
const result = [];
while (this.offset < this.end) {
while (this.offset < vectorEnd && this.offset < this.end) {
result.push(this.readFloat());
}
return result;
Expand Down

0 comments on commit 7cc06bd

Please sign in to comment.