From 1b3d59acf9ad83077b29074000dd1a3ada0ecb61 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Tue, 5 Jul 2022 00:11:35 +0200 Subject: [PATCH] urldata: reduce size of four ftp related members ftp_filemethod, ftpsslauth and ftp_ccc are now uchars accepttimeout is now unsigned int - almost 50 days ought to be enough for this value. Closes #9106 --- lib/setopt.c | 8 ++++---- lib/urldata.h | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/setopt.c b/lib/setopt.c index 1bb44bd919..d5e3b50c82 100644 --- a/lib/setopt.c +++ b/lib/setopt.c @@ -1481,10 +1481,10 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param) /* * The maximum time for curl to wait for FTP server connect */ - arg = va_arg(param, long); - if(arg < 0) - return CURLE_BAD_FUNCTION_ARGUMENT; - data->set.accepttimeout = arg; + uarg = va_arg(param, unsigned long); + if(uarg >= UINT_MAX) + uarg = UINT_MAX; + data->set.accepttimeout = (unsigned int)uarg; break; #endif diff --git a/lib/urldata.h b/lib/urldata.h index b3c6f16130..826d3190b3 100644 --- a/lib/urldata.h +++ b/lib/urldata.h @@ -1753,10 +1753,10 @@ struct UserDefined { file 0 - whatever, 1 - v2, 2 - v6 */ curl_off_t max_filesize; /* Maximum file size to download */ #ifndef CURL_DISABLE_FTP - curl_ftpfile ftp_filemethod; /* how to get to a file when FTP is used */ - curl_ftpauth ftpsslauth; /* what AUTH XXX to be attempted */ - curl_ftpccc ftp_ccc; /* FTP CCC options */ - long accepttimeout; /* in milliseconds, 0 means no timeout */ + unsigned char ftp_filemethod; /* how to get to a file: curl_ftpfile */ + unsigned char ftpsslauth; /* what AUTH XXX to try: curl_ftpauth */ + unsigned char ftp_ccc; /* FTP CCC options: curl_ftpccc */ + unsigned int accepttimeout; /* in milliseconds, 0 means no timeout */ #endif /* Desppie the name ftp_create_missing_dirs is for FTP(S) and SFTP 1 - create directories that don't exist -- 2.47.3