← Back to team overview

linuxdcpp-team team mailing list archive

[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 2282: Fix crash when zero sized bloom filter requested

 

------------------------------------------------------------
revno: 2282
committer: eMTee <emtee11@xxxxxxxxx>
branch nick: dcplusplus
timestamp: Mon 2010-11-01 22:55:40 +0100
message:
  Fix crash when zero sized bloom filter requested
modified:
  changelog.txt
  dcpp/AdcHub.cpp


--
lp:dcplusplus
https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk

Your team Dcplusplus-team is subscribed to branch lp:dcplusplus.
To unsubscribe from this branch go to https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk/+edit-subscription
=== modified file 'changelog.txt'
--- changelog.txt	2010-10-31 16:10:56 +0000
+++ changelog.txt	2010-11-01 21:55:40 +0000
@@ -26,6 +26,7 @@
 * Fix menu separators on Win 7 (poy)
 * [L#588224] Display folders using the correct icon on Win 7 (poy)
 * Help updates (poy, emtee)
+* [L#571914] Fix crash when zero sized bloom filter requested (emtee)
 
 -- 0.770 2010-07-05 --
 * [L#550300] Catch more potential file corruptions (thanks bigmuscle)

=== modified file 'dcpp/AdcHub.cpp'
--- dcpp/AdcHub.cpp	2010-08-30 14:04:10 +0000
+++ dcpp/AdcHub.cpp	2010-11-01 21:55:40 +0000
@@ -563,7 +563,9 @@
 			return;
 		}
 
-		ShareManager::getInstance()->getBloom(v, k, m, h);
+		if (m > 0) {
+			ShareManager::getInstance()->getBloom(v, k, m, h);
+		}
 		AdcCommand cmd(AdcCommand::CMD_SND, AdcCommand::TYPE_HUB);
 		cmd.addParam(c.getParam(0));
 		cmd.addParam(c.getParam(1));
@@ -571,7 +573,9 @@
 		cmd.addParam(c.getParam(3));
 		cmd.addParam(c.getParam(4));
 		send(cmd);
-		send((char*)&v[0], v.size());
+		if (m > 0) {
+			send((char*)&v[0], v.size());
+		}
 	}
 }