]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
certtool: increased buffer for reading from user
authorNikos Mavrogiannopoulos <nmav@redhat.com>
Tue, 28 Feb 2017 07:00:56 +0000 (08:00 +0100)
committerNikos Mavrogiannopoulos <nmav@redhat.com>
Tue, 28 Feb 2017 07:01:40 +0000 (08:01 +0100)
This allows reading longer than 128-byte fields interactively.
The new limit is 512-bytes.

Relates #179

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
src/certtool-cfg.c

index 7bbab9c423c5f8fe2aa0b0a60d8b0d7e85f791b7..73f273d43f43e164276d408a317b61cce3c5eecd 100644 (file)
@@ -554,11 +554,12 @@ int template_parse(const char *template)
 }
 
 #define IS_NEWLINE(x) ((x[0] == '\n') || (x[0] == '\r'))
+#define MAX_INPUT_SIZE 512
 
 void
 read_crt_set(gnutls_x509_crt_t crt, const char *input_str, const char *oid)
 {
-       char input[128];
+       char input[MAX_INPUT_SIZE];
        int ret;
 
        fputs(input_str, stderr);
@@ -580,7 +581,7 @@ read_crt_set(gnutls_x509_crt_t crt, const char *input_str, const char *oid)
 void
 read_crq_set(gnutls_x509_crq_t crq, const char *input_str, const char *oid)
 {
-       char input[128];
+       char input[MAX_INPUT_SIZE];
        int ret;
 
        fputs(input_str, stderr);
@@ -605,7 +606,7 @@ static int64_t read_int_with_default(const char *input_str, long def)
 {
        char *endptr;
        int64_t l;
-       static char input[128];
+       static char input[MAX_INPUT_SIZE];
 
        fprintf(stderr, input_str, def);
        if (fgets(input, sizeof(input), stdin) == NULL)
@@ -661,7 +662,7 @@ int64_t read_int(const char *input_str)
 
 const char *read_str(const char *input_str)
 {
-       static char input[128];
+       static char input[MAX_INPUT_SIZE];
        int len;
 
        fputs(input_str, stderr);
@@ -686,7 +687,7 @@ const char *read_str(const char *input_str)
  */
 int read_yesno(const char *input_str, int def)
 {
-       char input[128];
+       char input[MAX_INPUT_SIZE];
 
       restart:
        fputs(input_str, stderr);