summaryrefslogtreecommitdiff
path: root/src/ByteArrayDiskWriter.h
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2011-08-10 23:58:49 +0900
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2011-08-10 23:58:49 +0900
commit6edfa4e430d4f44dbcbb26dd236028bcc503a312 (patch)
treef8141bd6e2e7fa6b859a94d48168b1db7e8dde54 /src/ByteArrayDiskWriter.h
parent2d9323651b47bf4869d818045ad490aa59bfe632 (diff)
Limit maximum length of ByteArrayWriter.
aria2 downloads meta files such as .torrent and .metalink file in memory using ByteArrayWriter. To prevent accidentally download big file, we set the maximum length that ByteArrayWriter can hold. The default is 5MiB and it is reasonable because most .torrent and .metalink file are much smaller than that.
Diffstat (limited to 'src/ByteArrayDiskWriter.h')
-rw-r--r--src/ByteArrayDiskWriter.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/ByteArrayDiskWriter.h b/src/ByteArrayDiskWriter.h
index fee6ddfb..c51d8200 100644
--- a/src/ByteArrayDiskWriter.h
+++ b/src/ByteArrayDiskWriter.h
@@ -43,10 +43,10 @@ namespace aria2 {
class ByteArrayDiskWriter : public DiskWriter {
private:
std::stringstream buf_;
-
+ size_t maxLength_;
void clear();
public:
- ByteArrayDiskWriter();
+ ByteArrayDiskWriter(size_t maxLength = 5*1024*1024);
virtual ~ByteArrayDiskWriter();
virtual void initAndOpenFile(uint64_t totalLength = 0);