socket: protect against __proto__ deletion

This commit is contained in:
Guillermo Rauch
2012-12-18 17:00:44 -03:00
parent 2fa98fb61a
commit bd37a9a34b

View File

@@ -250,13 +250,13 @@ Socket.prototype.ack = function(){
*/
Socket.prototype.onack = function(packet){
var ack = this.acks[packet.id];
if (ack) {
var ack = this.acks[Number(packet.id)];
if ('function' == typeof ack) {
debug('calling ack %s with %j', packet.id, packet.data);
ack.apply(this, packet.data);
delete this.acks[packet.id];
} else {
debug('ack %s not found', packet.id);
debug('bad ack %s', packet.id);
}
};