diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2008-01-04 12:31:49 +0000 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2008-01-04 12:31:49 +0000 |
| commit | da4d9092b28863d7592cae17f1e97161bda91064 (patch) | |
| tree | fa26343a61f7747c2eab920c2158976c20afe015 /src/BencodeVisitor.cc | |
| parent | 853a8ef6aa33c8116fda5db7ad6fd4af4b82933e (diff) | |
2008-01-04 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Fixed segmentation fault when bad torrent metainfo is parsed.
Added dynamic_cast properly to detect the misconfiguration of
metainfo
and then throw exception or skip it.
* src/DefaultBtContext.{h, cc}
* test/DefaultBtContextTest.cc
* src/AnnounceList.cc
* src/CompactPeerListProcessor.cc
* src/message.h
* src/DefaultBtAnnounce.{h, cc}
* test/DefaultBtAnnounceTest.cc
* src/BencodeVisitor.cc
Diffstat (limited to 'src/BencodeVisitor.cc')
| -rw-r--r-- | src/BencodeVisitor.cc | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/BencodeVisitor.cc b/src/BencodeVisitor.cc index 32a11308..b21585ee 100644 --- a/src/BencodeVisitor.cc +++ b/src/BencodeVisitor.cc @@ -75,10 +75,10 @@ void BencodeVisitor::visit(const Dictionary* d) void BencodeVisitor::visit(const MetaEntry* e) { if(dynamic_cast<const Data*>(e) != 0) { - visit((const Data*)e); + visit(reinterpret_cast<const Data*>(e)); } else if(dynamic_cast<const List*>(e) != 0) { - visit((const List*)e); + visit(reinterpret_cast<const List*>(e)); } else if(dynamic_cast<const Dictionary*>(e) != 0) { - visit((const Dictionary*)e); + visit(reinterpret_cast<const Dictionary*>(e)); } } |
