X-Git-Url: https://git.llucax.com/software/mutt-debian.git/blobdiff_plain/44c01adf506b1087bff724dcb65b92a12b012836..84b9ea1689a8189d41ea4a821a1fd6cc446b9332:/pop_lib.c diff --git a/pop_lib.c b/pop_lib.c index ccbf691..d8cc9ea 100644 --- a/pop_lib.c +++ b/pop_lib.c @@ -43,6 +43,7 @@ int pop_parse_path (const char* path, ACCOUNT* acct) /* Defaults */ acct->flags = 0; acct->type = M_ACCT_TYPE_POP; + acct->port = 0; c = safe_strdup (path); url_parse_ciss (&url, c); @@ -60,10 +61,12 @@ int pop_parse_path (const char* path, ACCOUNT* acct) acct->flags |= M_ACCT_SSL; service = getservbyname (url.scheme == U_POP ? "pop3" : "pop3s", "tcp"); - if (service) - acct->port = ntohs (service->s_port); - else - acct->port = url.scheme == U_POP ? POP_PORT : POP_SSL_PORT;; + if (!acct->port) { + if (service) + acct->port = ntohs (service->s_port); + else + acct->port = url.scheme == U_POP ? POP_PORT : POP_SSL_PORT;; + } FREE (&c); return 0; @@ -495,7 +498,8 @@ int pop_fetch_data (POP_DATA *pop_data, char *query, progress_t *progressbar, strfcpy (inbuf + lenbuf, p, sizeof (buf)); pos += chunk; - if (chunk >= sizeof (buf)) + /* cast is safe since we break out of the loop when chunk<=0 */ + if ((size_t)chunk >= sizeof (buf)) { lenbuf += strlen (p); }