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;
 }
 
_______________________________________________
pld-cvs-commit mailing list
[email protected]
http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit

Reply via email to