SVN: toys/rsget.pl/RSGet/Curl.pm

sparky sparky at pld-linux.org
Sun Sep 26 23:43:52 CEST 2010


Author: sparky
Date: Sun Sep 26 23:43:51 2010
New Revision: 11820

Modified:
   toys/rsget.pl/RSGet/Curl.pm
Log:
- avoid huge memory consumption in case of broken getter plugin


Modified: toys/rsget.pl/RSGet/Curl.pm
==============================================================================
--- toys/rsget.pl/RSGet/Curl.pm	(original)
+++ toys/rsget.pl/RSGet/Curl.pm	Sun Sep 26 23:43:51 2010
@@ -427,6 +427,10 @@
 		die "\nCannot write data: $!\n" unless $p;
 	} else {
 		$supercurl->{body} .= $chunk;
+		if ( length $supercurl->{body} > 1 * 1024 * 1024 ) {
+			warn "Tried to save large archive to memory. Aborting. (plugin may be broken)\n";
+			return 0;
+		}
 	}
 
 	return $len;
@@ -436,6 +440,10 @@
 {
 	my ($chunk, $scalar) = @_;
 	$$scalar .= $chunk;
+	if ( length $$scalar > 1 * 1024 * 1024 ) {
+		warn "Tried to save large archive to memory. Aborting. (plugin may be broken)\n";
+		return 0;
+	}
 	return length $chunk;
 }
 


More information about the pld-cvs-commit mailing list