summaryrefslogtreecommitdiff
path: root/methods/gpgv.cc
diff options
context:
space:
mode:
Diffstat (limited to 'methods/gpgv.cc')
-rw-r--r--methods/gpgv.cc22
1 files changed, 18 insertions, 4 deletions
diff --git a/methods/gpgv.cc b/methods/gpgv.cc
index 3ad3e8d84..25ba0d063 100644
--- a/methods/gpgv.cc
+++ b/methods/gpgv.cc
@@ -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>
@@ -12,9 +14,13 @@
#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++;
}