validate rpc messages more carefully

pull/1/head
ansuz 8 years ago
parent 9e749b7cd8
commit 81c5e26a0a

@ -385,14 +385,22 @@ RPC.create = function (config, cb) {
var store;
var rpc = function (ctx, data, respond) {
if (!Array.isArray(data)) {
return void respond('INVALID_ARG_FORMAT');
}
if (!data.length) {
return void respond("INSUFFICIENT_ARGS");
} else if (data.length !== 1) {
console.log(data.length);
console.log('[UNEXPECTED_ARGUMENTS_LENGTH] %s', data.length);
}
var msg = data[0].slice(0);
if (!Array.isArray(msg)) {
return void respond('INVALID_ARG_FORMAT');
}
var signature = msg.shift();
var publicKey = msg.shift();

Loading…
Cancel
Save