removed URL size restrictions, dynamically allocates the needed buffer

size instead
This commit is contained in:
Daniel Stenberg 2000-11-20 08:54:32 +00:00
parent 42280e95bf
commit 5d4bceda20
1 changed files with 9 additions and 5 deletions

View File

@ -49,7 +49,7 @@
#include "../lib/memdebug.h" #include "../lib/memdebug.h"
#endif #endif
char glob_buffer[URL_MAX_LENGTH]; char *glob_buffer;
URLGlob *glob_expand; URLGlob *glob_expand;
int glob_word(char*, int); int glob_word(char*, int);
@ -210,10 +210,13 @@ int glob_word(char *pattern, int pos) {
int glob_url(URLGlob** glob, char* url, int *urlnum) int glob_url(URLGlob** glob, char* url, int *urlnum)
{ {
if (strlen(url)>URL_MAX_LENGTH) { /*
printf("Illegally sized URL\n"); * We can deal with any-size, just make a buffer with the same length
return CURLE_URL_MALFORMAT; * as the specified URL!
} */
glob_buffer=(char *)malloc(strlen(url)+1);
if(NULL == glob_buffer)
return CURLE_OUT_OF_MEMORY;
glob_expand = (URLGlob*)malloc(sizeof(URLGlob)); glob_expand = (URLGlob*)malloc(sizeof(URLGlob));
glob_expand->size = 0; glob_expand->size = 0;
@ -238,6 +241,7 @@ void glob_cleanup(URLGlob* glob) {
} }
} }
free(glob); free(glob);
free(glob_buffer);
} }
char *next_url(URLGlob *glob) char *next_url(URLGlob *glob)