patches/aria2-04-array-size.diff
author jurikm
Sun, 12 Feb 2012 14:04:10 +0000
changeset 8245 383896da4129
parent 84 1fed9192ba27
permissions -rw-r--r--
SFEsauerbraten.spec: add IPS package name

--- aria2-0.9.0/src/Util.cc.orig4	2006-12-12 13:59:26.681371000 +0800
+++ aria2-0.9.0/src/Util.cc	2006-12-12 14:00:04.421606000 +0800
@@ -271,7 +271,7 @@
 
 void Util::rangedFileCopy(const string& dest, const string& src, long long int srcOffset, long long int length) {
   int bufSize = 4096;
-  char buf[bufSize];
+  char buf[4096];
   int destFd = -1;
   int srcFd = -1;
   try {
@@ -438,7 +438,7 @@
   ctx.digestInit();
 
   int BUFLEN = 4096;
-  char buf[BUFLEN];
+  char buf[441];
 
   int fd;
   if((fd = open(filename.c_str(), O_RDWR, S_IRUSR|S_IWUSR)) < 0) {
--- aria2-0.9.0/src/MultiDiskWriter.cc.orig4	2006-12-12 14:56:28.933098000 +0800
+++ aria2-0.9.0/src/MultiDiskWriter.cc	2006-12-12 14:56:40.546940000 +0800
@@ -155,7 +155,7 @@
 
 void MultiDiskWriter::hashUpdate(DiskWriterEntry* entry, long long int offset, long long int length) {
   int BUFSIZE = 16*1024;
-  char buf[BUFSIZE];
+  char buf[16*1024];
   for(int i = 0; i < length/BUFSIZE; i++) {
     if(BUFSIZE != entry->diskWriter->readData(buf, BUFSIZE, offset)) {
       throw string("error");
--- aria2-0.9.0/src/PieceMessage.cc.orig4	2006-12-12 14:57:12.341281000 +0800
+++ aria2-0.9.0/src/PieceMessage.cc	2006-12-12 14:57:44.193258000 +0800
@@ -158,7 +158,7 @@
 
 int PieceMessage::sendPieceData(long long int offset, int length) const {
   int BUF_SIZE = 256;
-  char buf[BUF_SIZE];
+  char buf[256];
   int iteration = length/BUF_SIZE;
   int writtenLength = 0;
   PeerConnection* peerConnection = peerInteraction->getPeerConnection();
@@ -219,7 +219,7 @@
 
 void PieceMessage::erasePieceOnDisk(const Piece& piece) {
   int BUFSIZE = 4096;
-  char buf[BUFSIZE];
+  char buf[4096];
   memset(buf, 0, BUFSIZE);
   long long int offset =
     ((long long int)piece.getIndex())*btContext->getPieceLength();
--- aria2-0.9.0/src/DownloadCommand.cc.orig4	2006-12-12 15:34:49.693937000 +0800
+++ aria2-0.9.0/src/DownloadCommand.cc	2006-12-12 15:50:14.287200000 +0800
@@ -41,6 +41,7 @@
 #include "message.h"
 #include "prefs.h"
 #include <sys/time.h>
+#include <unistd.h>
 
 DownloadCommand::DownloadCommand(int cuid,
 				 const RequestHandle req,
@@ -75,13 +76,13 @@
     assert(te != NULL);
   }
   int bufSize = 4096;
-  char buf[bufSize];
+  char buf[4096];
   socket->readData(buf, bufSize);
   PeerStatHandle peerStat = e->segmentMan->getPeerStat(cuid);
   assert(peerStat.get());
   if(te != NULL) {
     int infbufSize = 4096;
-    char infbuf[infbufSize];
+    char infbuf[4096];
     te->inflate(infbuf, infbufSize, buf, bufSize);
     e->segmentMan->diskWriter->writeData(infbuf, infbufSize,
 					 segment.getPosition()+segment.writtenLength);
--- aria2-0.9.0/src/AbstractDiskWriter.cc.orig4	2006-12-12 14:02:25.735451000 +0800
+++ aria2-0.9.0/src/AbstractDiskWriter.cc	2006-12-12 14:02:43.860295000 +0800
@@ -120,7 +120,7 @@
   ctx.digestReset();
   try {
     int BUFSIZE = 16*1024;
-    char buf[BUFSIZE];
+    char buf[16*1024];
     for(int i = 0; i < length/BUFSIZE; i++) {
       if(BUFSIZE != readData(buf, BUFSIZE, offset)) {
 	throw string("error");