mirror of https://github.com/aria2/aria2
2009-02-12 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Use dynamically allocated char array to detect memory access violation. * src/DHTRoutingTableDeserializer.ccpull/1/head
parent
509c13c173
commit
5547b3a5ed
|
@ -1,3 +1,9 @@
|
|||
2009-02-12 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||
|
||||
Use dynamically allocated char array to detect memory access
|
||||
violation.
|
||||
* src/DHTRoutingTableDeserializer.cc
|
||||
|
||||
2009-02-12 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||
|
||||
Set struct sockaddr_in.sin_len if HAVE_SOCKADDR_IN_SIN_LEN is
|
||||
|
|
|
@ -33,6 +33,12 @@
|
|||
*/
|
||||
/* copyright --> */
|
||||
#include "DHTRoutingTableDeserializer.h"
|
||||
|
||||
#include <cerrno>
|
||||
#include <cstring>
|
||||
#include <istream>
|
||||
#include <utility>
|
||||
|
||||
#include "DHTNode.h"
|
||||
#include "DHTConstants.h"
|
||||
#include "PeerMessageUtil.h"
|
||||
|
@ -41,10 +47,7 @@
|
|||
#include "a2netcompat.h"
|
||||
#include "StringFormat.h"
|
||||
#include "Util.h"
|
||||
#include <cerrno>
|
||||
#include <cstring>
|
||||
#include <istream>
|
||||
#include <utility>
|
||||
#include "array_fun.h"
|
||||
|
||||
namespace aria2 {
|
||||
|
||||
|
@ -91,7 +94,12 @@ void DHTRoutingTableDeserializer::deserialize(std::istream& in)
|
|||
memset(zero, 0, sizeof(zero));
|
||||
|
||||
int version;
|
||||
char buf[55];
|
||||
|
||||
// If you change the code to read more than the size of buf, then
|
||||
// expand the buf size here.
|
||||
char* buf = new char[255];
|
||||
array_ptr<char> holder(buf);
|
||||
|
||||
// header
|
||||
in.read(buf, 8);
|
||||
if(memcmp(header, buf, 8) == 0) {
|
||||
|
|
Loading…
Reference in New Issue