diff options
author | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2018-07-26 10:56:25 +0200 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2018-07-26 10:57:03 +0200 |
commit | 403edfeff5a29a643d0d38b7f85f49b7ed3e40b1 (patch) | |
tree | f266b6fb15facae6b4ab996f323dc014505bd8d3 | |
parent | d59659792474abfc61e6a95f3b72485245fbf856 (diff) | |
download | gnutls-403edfeff5a29a643d0d38b7f85f49b7ed3e40b1.tar.gz |
certtool: eliminate maximum limit in fields read with READ_MULTI_LINE_TOKENIZED()
This allows to generate a certificate with an extension of arbitrary size.
Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
-rw-r--r-- | src/certtool-cfg.c | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/src/certtool-cfg.c b/src/certtool-cfg.c index f13dabfa82..b2f4e9ce11 100644 --- a/src/certtool-cfg.c +++ b/src/certtool-cfg.c @@ -261,22 +261,15 @@ void cfg_init(void) val = optionGetValue(pov, name); \ if (val != NULL && val->valType == OPARG_TYPE_STRING) \ { \ - char str[512]; \ - char * p; \ - size_t len; \ + char *str; \ + char *p; \ if (s_name == NULL) { \ i = 0; \ s_name = malloc(sizeof(char*)*MAX_ENTRIES); \ do { \ if (val && strcmp(val->pzName, name)!=0) \ continue; \ - len = strlen(val->v.strVal); \ - if (sizeof(str) > (unsigned)len) { \ - strcpy(str, val->v.strVal); \ - } else { \ - memcpy(str, val->v.strVal, sizeof(str)-1); \ - str[sizeof(str)-1] = 0; \ - } \ + str = strdup(val->v.strVal); \ if ((p=strchr(str, ' ')) == NULL && (p=strchr(str, '\t')) == NULL) { \ fprintf(stderr, "Error parsing %s\n", name); \ exit(1); \ @@ -291,6 +284,7 @@ void cfg_init(void) } \ s_name[i+1] = strdup(p); \ i+=2; \ + free(str); \ if (i>=MAX_ENTRIES) \ break; \ } while((val = optionNextValue(pov, val)) != NULL); \ |