diff options
author | dartraiden <wowemuh@gmail.com> | 2024-03-27 16:04:05 +0300 |
---|---|---|
committer | dartraiden <wowemuh@gmail.com> | 2024-03-27 16:04:05 +0300 |
commit | 26b7f4e979561aa1f17d6719fc1dad91e1a5d1b4 (patch) | |
tree | 98aafdc421d93e855ddc886fe56e9e084f992ac8 /libs/libcurl/src/netrc.c | |
parent | 9be45ab3f9c03107dfb717798e41dda72576122d (diff) |
libcurl: update to 8.7.1
Diffstat (limited to 'libs/libcurl/src/netrc.c')
-rw-r--r-- | libs/libcurl/src/netrc.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/libs/libcurl/src/netrc.c b/libs/libcurl/src/netrc.c index 72680af665..700e085cf0 100644 --- a/libs/libcurl/src/netrc.c +++ b/libs/libcurl/src/netrc.c @@ -53,6 +53,8 @@ enum host_lookup_state { #define NETRC_FAILED -1
#define NETRC_SUCCESS 0
+#define MAX_NETRC_LINE 4096
+
/*
* Returns zero on success.
*/
@@ -80,13 +82,14 @@ static int parsenetrc(const char *host, file = fopen(netrcfile, FOPEN_READTEXT);
if(file) {
bool done = FALSE;
- char netrcbuffer[4096];
- int netrcbuffsize = (int)sizeof(netrcbuffer);
+ struct dynbuf buf;
+ Curl_dyn_init(&buf, MAX_NETRC_LINE);
- while(!done && Curl_get_line(netrcbuffer, netrcbuffsize, file)) {
+ while(!done && Curl_get_line(&buf, file)) {
char *tok;
char *tok_end;
bool quoted;
+ char *netrcbuffer = Curl_dyn_ptr(&buf);
if(state == MACDEF) {
if((netrcbuffer[0] == '\n') || (netrcbuffer[0] == '\r'))
state = NOTHING;
@@ -245,6 +248,7 @@ static int parsenetrc(const char *host, } /* while Curl_get_line() */
out:
+ Curl_dyn_free(&buf);
if(!retcode) {
/* success */
if(login_alloc) {
|