summaryrefslogtreecommitdiff
path: root/methods/gpgv.cc
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2012-01-20 10:27:03 +0100
committerMichael Vogt <michael.vogt@ubuntu.com>2012-01-20 10:27:03 +0100
commit2c384bb626cbaa682c20b94beb14589611847191 (patch)
tree5a0afc2503e334bebdc13ce80ab832d88e289281 /methods/gpgv.cc
parenta7025171ea8bb49975f98dd4c3c6c7d89335cd30 (diff)
parent809cf6d22a9bb72061aedf2670c78b57d9da6999 (diff)
merged from bzr+ssh://bazaar.launchpad.net/~donkult/apt/experimental/
Diffstat (limited to 'methods/gpgv.cc')
-rw-r--r--methods/gpgv.cc12
1 files changed, 10 insertions, 2 deletions
diff --git a/methods/gpgv.cc b/methods/gpgv.cc
index 2b2aba017..25ba0d063 100644
--- a/methods/gpgv.cc
+++ b/methods/gpgv.cc
@@ -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++;
}