Bugfix in packet_length calculation

One of the bitshifts used to construct tmplen (lines 230-231) was inconsistent with the other expressions:

(input[mypos2++].charCodeAt() << 8)

causing following error:

TypeError: Cannot call method 'charCodeAt' of undefined
    at Object.module.exports.read (/home/scott/dev/keystone/fetch/node_modules/openpgp/src/packet/packet.js:231:16)

Corrected to 

(input.charCodeAt(mypos2++) << 8)
This commit is contained in:
inovari 2014-07-16 15:37:06 -04:00
parent 8a27866225
commit 91ccbeed80

View File

@ -227,8 +227,8 @@ module.exports = {
mypos2 += tmplen; mypos2 += tmplen;
} else { } else {
mypos2++; mypos2++;
tmplen = (input.charCodeAt(mypos2++) << 24) | (input.charCodeAt(mypos2++) << 16) | (input[mypos2++] tmplen = (input.charCodeAt(mypos2++) << 24) | (input.charCodeAt(mypos2++) << 16) | (input
.charCodeAt() << 8) | input.charCodeAt(mypos2++); .charCodeAt(mypos2++) << 8) | input.charCodeAt(mypos2++);
bodydata += input.substring(mypos2, mypos2 + tmplen); bodydata += input.substring(mypos2, mypos2 + tmplen);
packet_length += tmplen; packet_length += tmplen;
mypos2 += tmplen; mypos2 += tmplen;