Permalink
Browse files

Check for nul lvalues in collection deserializers [Fixes #136]

  • Loading branch information...
1 parent e8a8361 commit 70593a2387652f3a4742d9ce178e3a5d41321bae @devdazed devdazed committed Feb 17, 2014
Showing with 9 additions and 1 deletion.
  1. +9 −1 lib/marshal/index.js
View
@@ -233,6 +233,10 @@ function compositeDeserializer(deserializers){
*/
function listDeserializer(deserializer){
return function(str){
+ if(val === null || val === undefined){
+ return null;
+ }
+
var buf = new Buffer(str, 'binary'),
pos = 2, len, vals = [], key, value;
@@ -256,9 +260,13 @@ function listDeserializer(deserializer){
*/
function mapDeserializer(deserializers){
return function(str){
+ if(val === null || val === undefined){
+ return null;
+ }
+
var buf = new Buffer(str, 'binary'),
pos = 2, len, vals = {}, key, value;
-
+
while( pos < buf.length){
len = buf.readUInt16BE(pos);
pos += 2

0 comments on commit 70593a2

Please sign in to comment.