]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
certtool: ensure that allocated buffer has a minimum size of 64kb.
authorNikos Mavrogiannopoulos <nmav@redhat.com>
Thu, 5 Jun 2014 14:41:22 +0000 (16:41 +0200)
committerNikos Mavrogiannopoulos <nmav@redhat.com>
Thu, 5 Jun 2014 14:41:22 +0000 (16:41 +0200)
src/certtool-common.c

index 4f4c39547396d00152062cfa0da964a70a2a18b8..3b019f8632cf2eaa1e29dd2437c34d48a6a76385 100644 (file)
@@ -41,6 +41,7 @@
 #include "certtool-common.h"
 #include "certtool-args.h"
 #include "certtool-cfg.h"
+#include <minmax.h>
 
 /* Gnulib portability files. */
 #include <read-file.h>
@@ -54,7 +55,7 @@ void fix_lbuffer(unsigned size)
                if (size == 0)
                        lbuffer_size = 64*1024;
                else
-                       lbuffer_size = size;
+                       lbuffer_size = MAX(64*1024,size);
                lbuffer = malloc(lbuffer_size);
                if (lbuffer == NULL) {
                        fprintf(stderr, "memory error");