diff options
Diffstat (limited to 'src/lib/libcrypto/conf/conf_def.c')
-rw-r--r-- | src/lib/libcrypto/conf/conf_def.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/lib/libcrypto/conf/conf_def.c b/src/lib/libcrypto/conf/conf_def.c index 48ff6f1120..b52ee01a3c 100644 --- a/src/lib/libcrypto/conf/conf_def.c +++ b/src/lib/libcrypto/conf/conf_def.c | |||
@@ -208,7 +208,8 @@ static int def_load(CONF *conf, const char *name, long *line) | |||
208 | 208 | ||
209 | static int def_load_bio(CONF *conf, BIO *in, long *line) | 209 | static int def_load_bio(CONF *conf, BIO *in, long *line) |
210 | { | 210 | { |
211 | #define BUFSIZE 512 | 211 | /* The macro BUFSIZE conflicts with a system macro in VxWorks */ |
212 | #define CONFBUFSIZE 512 | ||
212 | int bufnum=0,i,ii; | 213 | int bufnum=0,i,ii; |
213 | BUF_MEM *buff=NULL; | 214 | BUF_MEM *buff=NULL; |
214 | char *s,*p,*end; | 215 | char *s,*p,*end; |
@@ -252,20 +253,21 @@ static int def_load_bio(CONF *conf, BIO *in, long *line) | |||
252 | section_sk=(STACK_OF(CONF_VALUE) *)sv->value; | 253 | section_sk=(STACK_OF(CONF_VALUE) *)sv->value; |
253 | 254 | ||
254 | bufnum=0; | 255 | bufnum=0; |
256 | again=0; | ||
255 | for (;;) | 257 | for (;;) |
256 | { | 258 | { |
257 | again=0; | 259 | if (!BUF_MEM_grow(buff,bufnum+CONFBUFSIZE)) |
258 | if (!BUF_MEM_grow(buff,bufnum+BUFSIZE)) | ||
259 | { | 260 | { |
260 | CONFerr(CONF_F_CONF_LOAD_BIO,ERR_R_BUF_LIB); | 261 | CONFerr(CONF_F_CONF_LOAD_BIO,ERR_R_BUF_LIB); |
261 | goto err; | 262 | goto err; |
262 | } | 263 | } |
263 | p= &(buff->data[bufnum]); | 264 | p= &(buff->data[bufnum]); |
264 | *p='\0'; | 265 | *p='\0'; |
265 | BIO_gets(in, p, BUFSIZE-1); | 266 | BIO_gets(in, p, CONFBUFSIZE-1); |
266 | p[BUFSIZE-1]='\0'; | 267 | p[CONFBUFSIZE-1]='\0'; |
267 | ii=i=strlen(p); | 268 | ii=i=strlen(p); |
268 | if (i == 0) break; | 269 | if (i == 0 && !again) break; |
270 | again=0; | ||
269 | while (i > 0) | 271 | while (i > 0) |
270 | { | 272 | { |
271 | if ((p[i-1] != '\r') && (p[i-1] != '\n')) | 273 | if ((p[i-1] != '\r') && (p[i-1] != '\n')) |
@@ -275,7 +277,7 @@ static int def_load_bio(CONF *conf, BIO *in, long *line) | |||
275 | } | 277 | } |
276 | /* we removed some trailing stuff so there is a new | 278 | /* we removed some trailing stuff so there is a new |
277 | * line on the end. */ | 279 | * line on the end. */ |
278 | if (i == ii) | 280 | if (ii && i == ii) |
279 | again=1; /* long line */ | 281 | again=1; /* long line */ |
280 | else | 282 | else |
281 | { | 283 | { |
@@ -627,7 +629,7 @@ static int str_copy(CONF *conf, char *section, char **pto, char *from) | |||
627 | CONFerr(CONF_F_STR_COPY,CONF_R_VARIABLE_HAS_NO_VALUE); | 629 | CONFerr(CONF_F_STR_COPY,CONF_R_VARIABLE_HAS_NO_VALUE); |
628 | goto err; | 630 | goto err; |
629 | } | 631 | } |
630 | BUF_MEM_grow(buf,(strlen(p)+len-(e-from))); | 632 | BUF_MEM_grow_clean(buf,(strlen(p)+len-(e-from))); |
631 | while (*p) | 633 | while (*p) |
632 | buf->data[to++]= *(p++); | 634 | buf->data[to++]= *(p++); |
633 | from=e; | 635 | from=e; |