diff -ur apt-lenny1/debian/changelog apt-lenny2/debian/changelog
--- apt-lenny1/debian/changelog	2009-04-20 21:49:11.000000000 +0200
+++ apt-lenny2/debian/changelog	2010-05-11 14:20:29.739711022 +0200
@@ -1,3 +1,10 @@
+apt (0.7.20.2+lenny2) UNRELEASED; urgency=low
+
+  * ftparchive/writer.cc:
+    - remove 999 chars Files rewrite limit (Closes: #577759)
+
+ -- David Kalnischkies <kalnischkies@gmail.com>  Tue, 11 May 2010 11:19:34 +0200
+
 apt (0.7.20.2+lenny1) stable-security; urgency=high
 
   * debian/apt.cron.daily:
diff -ur apt-lenny1/ftparchive/writer.cc apt-lenny2/ftparchive/writer.cc
--- apt-lenny1/ftparchive/writer.cc	2009-02-07 16:09:35.000000000 +0100
+++ apt-lenny2/ftparchive/writer.cc	2010-05-11 14:25:18.384725898 +0200
@@ -28,6 +28,7 @@
 #include <ftw.h>
 #include <fnmatch.h>
 #include <iostream>
+#include <sstream>
 #include <memory>
     
 #include "cachedb.h"
@@ -628,11 +629,10 @@
    }
    
    // Add the dsc to the files hash list
-   char Files[1000];
-   snprintf(Files,sizeof(Files),"\n %s %lu %s\n %s",
-	    string(MD5.Result()).c_str(),St.st_size,
-	    flNotDir(FileName).c_str(),
-	    Tags.FindS("Files").c_str());
+   std::ostringstream ostreamFiles;
+   ostreamFiles << "\n " << string(MD5.Result()) << " " << St.st_size << " "
+		<< flNotDir(FileName) << "\n " << Tags.FindS("Files");
+   string const Files = ostreamFiles.str();
    
    // Strip the DirStrip prefix from the FileName and add the PathPrefix
    string NewFileName;
@@ -650,7 +650,7 @@
 
    // Perform the delinking operation over all of the files
    string ParseJnk;
-   const char *C = Files;
+   const char *C = Files.c_str();
    for (;isspace(*C); C++);
    while (*C != 0)
    {   
@@ -681,7 +681,7 @@
 
    unsigned int End = 0;
    SetTFRewriteData(Changes[End++],"Source",Package.c_str(),"Package");
-   SetTFRewriteData(Changes[End++],"Files",Files);
+   SetTFRewriteData(Changes[End++],"Files",Files.c_str());
    if (Directory != "./")
       SetTFRewriteData(Changes[End++],"Directory",Directory.c_str());
    SetTFRewriteData(Changes[End++],"Priority",BestPrio.c_str());
