mirror of
https://github.com/curl/curl.git
synced 2026-08-25 09:33:36 +03:00
libssh2: setting atime or mtime >32bit on 4-bytes-long systems
Since the libssh2 API uses 'long' to store the timestamp, it cannot transfer >32bit times on Windows and 32bit architecture builds. Avoid nasty surprises by instead not setting such time. Spotted by Coverity Closes #9325
This commit is contained in:
parent
44a02d2532
commit
8e88e52ed0
1 changed files with 18 additions and 4 deletions
|
|
@ -1766,8 +1766,15 @@ static CURLcode ssh_statemach_act(struct Curl_easy *data, bool *block)
|
||||||
sshc->actualcode = CURLE_QUOTE_ERROR;
|
sshc->actualcode = CURLE_QUOTE_ERROR;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
sshp->quote_attrs.atime = (unsigned long)date;
|
#if SIZEOF_TIME_T > SIZEOF_LONG
|
||||||
sshp->quote_attrs.flags = LIBSSH2_SFTP_ATTR_ACMODTIME;
|
if(date > 0xffffffff)
|
||||||
|
;
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
sshp->quote_attrs.atime = (unsigned long)date;
|
||||||
|
sshp->quote_attrs.flags = LIBSSH2_SFTP_ATTR_ACMODTIME;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if(strncasecompare(cmd, "mtime", 5)) {
|
else if(strncasecompare(cmd, "mtime", 5)) {
|
||||||
time_t date = Curl_getdate_capped(sshc->quote_path1);
|
time_t date = Curl_getdate_capped(sshc->quote_path1);
|
||||||
|
|
@ -1780,8 +1787,15 @@ static CURLcode ssh_statemach_act(struct Curl_easy *data, bool *block)
|
||||||
sshc->actualcode = CURLE_QUOTE_ERROR;
|
sshc->actualcode = CURLE_QUOTE_ERROR;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
sshp->quote_attrs.mtime = (unsigned long)date;
|
#if SIZEOF_TIME_T > SIZEOF_LONG
|
||||||
sshp->quote_attrs.flags = LIBSSH2_SFTP_ATTR_ACMODTIME;
|
if(date > 0xffffffff)
|
||||||
|
;
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
sshp->quote_attrs.mtime = (unsigned long)date;
|
||||||
|
sshp->quote_attrs.flags = LIBSSH2_SFTP_ATTR_ACMODTIME;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Now send the completed structure... */
|
/* Now send the completed structure... */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue