From 115cb942dc3078477e3245f212a86e00d9783dc9 Mon Sep 17 00:00:00 2001 From: gardners Date: Tue, 22 May 2012 17:33:33 +0930 Subject: [PATCH] included fix for suppressing bad behaviour due to signature-less manifests. --- rhizome_packetformats.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/rhizome_packetformats.c b/rhizome_packetformats.c index 3fc6e4e2..35a88689 100644 --- a/rhizome_packetformats.c +++ b/rhizome_packetformats.c @@ -337,10 +337,25 @@ int overlay_rhizome_saw_advertisements(int i,overlay_frame *f, long long now) energy, everytime we see a manifest that we already have). In fact, it would be better here to do a really rough and ready parser to get the id and version fields out, and avoid the memory copies that - otherwise happen. */ + otherwise happen. + But we do need to make sure that at least one signature is there. + */ m=rhizome_read_manifest_file((char *)&f->payload->bytes[ofs], manifest_length,RHIZOME_DONTVERIFY); - int importManifest=0; + /* Crude signature presence test */ + for(i=m->manifest_all_bytes-1;i>0;i++) + if (!m->manifestdata[i]) { + /* A null in the middle says we have a signature */ + break; + } + if (!i) { + /* ignore the announcement, but don't ignore other people + offering the same manifest */ + WHY("Ignoring manifest announcment with no signature"); + rhizome_manifest_free(m); + return 0; + } + int importManifest=0; if (rhizome_ignore_manifest_check(m,(struct sockaddr_in *)f->recvaddr)) { /* Ignoring manifest that has caused us problems recently */