Commit 682c3a5400995ac0d881d88c82a8647730578ba2
validate types before calling gossip.add
Dominic Tarr committed on 10/2/2016, 11:38:12 AMParent: 89b461182f81d528dca83a253120f017014cfc19
Files changed
plugins/gossip/init.js | changed |
plugins/gossip/init.js | |||
---|---|---|---|
@@ -1,6 +1,7 @@ | |||
1 | 1 … | var isArray = Array.isArray | |
2 | 2 … | var pull = require('pull-stream') | |
3 … | +var ref = require('ssb-ref') | ||
3 | 4 … | ||
4 | 5 … | module.exports = function (gossip, config, server) { | |
5 | 6 … | ||
6 | 7 … | // populate peertable with configured seeds (mainly used in testing) | |
@@ -15,9 +16,10 @@ | |||
15 | 16 … | type: 'pub', live: true, keys: false | |
16 | 17 … | }), | |
17 | 18 … | pull.drain(function (msg) { | |
18 | 19 … | if(!msg.content.address) return | |
19 | - gossip.add(msg.content.address, 'pub') | ||
20 … | + if(ref.isAddress(msg.content.address)) | ||
21 … | + gossip.add(msg.content.address, 'pub') | ||
20 | 22 … | }) | |
21 | 23 … | ) | |
22 | 24 … | ||
23 | 25 … | // populate peertable with announcements on the LAN multicast |
Built with git-ssb-web