bplist-parser
Advanced tools
+26
-10
@@ -15,9 +15,6 @@ 'use strict'; | ||
| var parseFile = exports.parseFile = function (fileName, callback) { | ||
| fs.readFile(fileName, function (err, data) { | ||
| if (err) { | ||
| return callback(err); | ||
| } | ||
| var parseFile = exports.parseFile = function (fileNameOrBuffer, callback) { | ||
| function tryParseBuffer(buffer) { | ||
| try { | ||
| var result = parseBuffer(data); | ||
| var result = parseBuffer(buffer); | ||
| return callback(null, result); | ||
@@ -27,3 +24,12 @@ } catch (ex) { | ||
| } | ||
| }); | ||
| } | ||
| if (Buffer.isBuffer(fileNameOrBuffer)) { | ||
| return tryParseBuffer(fileNameOrBuffer); | ||
| } else { | ||
| fs.readFile(fileNameOrBuffer, function (err, data) { | ||
| if (err) { return callback(err); } | ||
| tryParseBuffer(data); | ||
| }); | ||
| } | ||
| }; | ||
@@ -88,4 +94,5 @@ | ||
| case 0x1: | ||
| case 0x8: // UID (really just an integer) | ||
| return parseInteger(); | ||
| case 0x8: | ||
| return parseUID(); | ||
| case 0x2: | ||
@@ -134,2 +141,11 @@ return parseReal(); | ||
| function parseUID() { | ||
| var length = objInfo + 1; | ||
| if (length < exports.maxObjectSize) { | ||
| return readUInt(buffer.slice(offset + 1, offset + 1 + length)); | ||
| } else { | ||
| throw new Error("To little heap space available! Wanted to read " + length + " bytes, but only " + exports.maxObjectSize + " are available."); | ||
| } | ||
| } | ||
| function parseReal() { | ||
@@ -208,3 +224,3 @@ var length = Math.pow(2, objInfo); | ||
| if (isUtf16) { | ||
| plistString = swapBytes(plistString); | ||
| plistString = swapBytes(plistString); | ||
| enc = "ucs2"; | ||
@@ -314,2 +330,2 @@ } | ||
| return buffer; | ||
| } | ||
| } |
+1
-1
| { | ||
| "name": "bplist-parser", | ||
| "version": "0.0.4", | ||
| "version": "0.0.5", | ||
| "description": "Binary plist parser.", | ||
@@ -5,0 +5,0 @@ "main": "bplistParser.js", |
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Non-existent author
Supply chain riskThe package was published by an npm account that no longer exists.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
43588
1.24%396
3.94%0
-100%