File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -46,6 +46,11 @@ ReplyParser.prototype._parseResult = function (type) {
46
46
// include the delimiter
47
47
this . _offset = end + 2 ;
48
48
49
+ if ( end > this . _buffer . length ) {
50
+ this . _offset = start ;
51
+ throw new Error ( "too far" ) ;
52
+ }
53
+
49
54
if ( this . options . return_buffers ) {
50
55
return this . _buffer . slice ( start , end ) ;
51
56
} else {
@@ -63,6 +68,11 @@ ReplyParser.prototype._parseResult = function (type) {
63
68
// include the delimiter
64
69
this . _offset = end + 2 ;
65
70
71
+ if ( end > this . _buffer . length ) {
72
+ this . _offset = start ;
73
+ throw new Error ( "too far" ) ;
74
+ }
75
+
66
76
// return the coerced numeric value
67
77
return + small_toString ( this . _buffer , start , end ) ;
68
78
} else if ( type === 36 ) { // $
@@ -85,7 +95,7 @@ ReplyParser.prototype._parseResult = function (type) {
85
95
86
96
if ( end > this . _buffer . length ) {
87
97
this . _offset = offset ;
88
- return null ;
98
+ throw new Error ( "too far" ) ;
89
99
}
90
100
91
101
if ( this . options . return_buffers ) {
You can’t perform that action at this time.
0 commit comments