multiparty
Advanced tools
Comparing version 2.1.3 to 2.1.4
@@ -0,1 +1,5 @@ | ||
### 2.1.4 | ||
* fix crash for invalid requests | ||
### 2.1.3 | ||
@@ -2,0 +6,0 @@ |
20
index.js
@@ -156,7 +156,7 @@ exports.Form = Form; | ||
if (index === boundaryLength - 2) { | ||
if (c !== CR) return cb(new Error("Expected CR Received " + c)); | ||
if (c !== CR) return error(self, new Error("Expected CR Received " + c)); | ||
index++; | ||
break; | ||
} else if (index === boundaryLength - 1) { | ||
if (c !== LF) return cb(new Error("Expected LF Received " + c)); | ||
if (c !== LF) return error(self, new Error("Expected LF Received " + c)); | ||
index = 0; | ||
@@ -189,3 +189,3 @@ self.onParsePartBegin(); | ||
// empty header field | ||
cb(new Error("Empty header field")); | ||
error(self, new Error("Empty header field")); | ||
return; | ||
@@ -201,3 +201,4 @@ } | ||
if (cl < A || cl > Z) { | ||
cb(new Error("Expected alphabetic character, received " + c)); | ||
error(self, new Error("Expected alphabetic character, received " + c)); | ||
return; | ||
} | ||
@@ -220,9 +221,9 @@ break; | ||
case HEADER_VALUE_ALMOST_DONE: | ||
if (c !== LF) return cb(new Error("Expected LF Received " + c)); | ||
if (c !== LF) return error(self, new Error("Expected LF Received " + c)); | ||
state = HEADER_FIELD_START; | ||
break; | ||
case HEADERS_ALMOST_DONE: | ||
if (c !== LF) return cb(new Error("Expected LF Received " + c)); | ||
if (c !== LF) return error(self, new Error("Expected LF Received " + c)); | ||
var err = self.onParseHeadersEnd(i + 1); | ||
if (err) return cb(err); | ||
if (err) return error(self, err); | ||
state = PART_DATA_START; | ||
@@ -311,3 +312,4 @@ break; | ||
default: | ||
cb(new Error("Parser has invalid state.")); | ||
error(self, new Error("Parser has invalid state.")); | ||
return; | ||
} | ||
@@ -454,3 +456,3 @@ } | ||
function error(self, err) { | ||
assert.ok(!self.error); | ||
assert.ok(!self.error, err.stack); | ||
self.error = err; | ||
@@ -457,0 +459,0 @@ self.emit('error', err); |
{ | ||
"name": "multiparty", | ||
"version": "2.1.3", | ||
"version": "2.1.4", | ||
"description": "multipart/form-data parser which supports streaming", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3562087
52
1214
12