]> git.saurik.com Git - apt.git/blobdiff - methods/gpgv.cc
trigger the usage of the fallback code for kfreebsd also in the
[apt.git] / methods / gpgv.cc
index 3ad3e8d84ca7e6b83a7cb8d2ab0afab960b31fc7..25ba0d06350e433701b85add7c392201c36b65c7 100644 (file)
@@ -1,9 +1,11 @@
+#include <config.h>
+
 #include <apt-pkg/error.h>
 #include <apt-pkg/acquire-method.h>
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/fileutl.h>
 #include <apt-pkg/indexcopy.h>
-#include <apti18n.h>
+#include <apt-pkg/configuration.h>
 
 #include <utime.h>
 #include <stdio.h>
 #include <sys/wait.h>
 #include <iostream>
 #include <sstream>
-
 #include <vector>
 
+#include <apti18n.h>
+
+using std::string;
+using std::vector;
+
 #define GNUPGPREFIX "[GNUPG:]"
 #define GNUPGBADSIG "[GNUPG:] BADSIG"
 #define GNUPGNOPUBKEY "[GNUPG:] NO_PUBKEY"
@@ -92,8 +98,16 @@ string GPGVMethod::VerifyGetSigners(const char *file, const char *outfile,
       // Read a line.  Sigh.
       while ((c = getc(pipein)) != EOF && c != '\n')
       {
-         if (bufferoff == buffersize)
-            buffer = (char *) realloc(buffer, buffersize *= 2);
+        if (bufferoff == buffersize)
+        {
+           char* newBuffer = (char *) realloc(buffer, buffersize *= 2);
+           if (newBuffer == NULL)
+           {
+              free(buffer);
+              return "Couldn't allocate a buffer big enough for reading";
+           }
+           buffer = newBuffer;
+        }
          *(buffer+bufferoff) = c;
          bufferoff++;
       }