]> git.saurik.com Git - apt.git/blobdiff - methods/gpgv.cc
* apt-pkg/pkgcache.cc:
[apt.git] / methods / gpgv.cc
index 2b2aba017c45e6df20968700b45f2d4172c21491..25ba0d06350e433701b85add7c392201c36b65c7 100644 (file)
@@ -98,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++;
       }