Skip to content

Commit

Permalink
removed bug caused by uninitialized variable h in function HeaderPars…
Browse files Browse the repository at this point in the history
…er.prototype._parseHeader
  • Loading branch information
RolandHeinze committed Aug 10, 2021
1 parent 524254c commit b7fca2e
Showing 1 changed file with 20 additions and 18 deletions.
38 changes: 20 additions & 18 deletions lib/HeaderParser.js
Expand Up @@ -82,26 +82,28 @@ HeaderParser.prototype._parseHeader = function() {
// folded header content
// RFC2822 says to just remove the CRLF and not the whitespace following
// it, so we follow the RFC and include the leading whitespace ...
this.header[h][this.header[h].length - 1] += lines[i];
} else {
m = RE_HDR.exec(lines[i]);
if (m) {
h = m[1].toLowerCase();
if (m[2]) {
if (this.header[h] === undefined)
this.header[h] = [m[2]];
else
this.header[h].push(m[2]);
} else
this.header[h] = [''];
if (++this.npairs === this.maxHeaderPairs)
break;
} else {
this.buffer = lines[i];
modded = true;
break;
if (h) {
this.header[h][this.header[h].length - 1] += lines[i];
continue;
}
}
m = RE_HDR.exec(lines[i]);
if (m) {
h = m[1].toLowerCase();
if (m[2]) {
if (this.header[h] === undefined)
this.header[h] = [m[2]];
else
this.header[h].push(m[2]);
} else
this.header[h] = [''];
if (++this.npairs === this.maxHeaderPairs)
break;
} else {
this.buffer = lines[i];
modded = true;
break;
}
}
if (!modded)
this.buffer = '';
Expand Down

0 comments on commit b7fca2e

Please sign in to comment.