]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
libssh: make atime and mtime cap the timestamp instead of wrap
authorDaniel Stenberg <daniel@haxx.se>
Thu, 9 Oct 2025 21:21:37 +0000 (23:21 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Fri, 10 Oct 2025 06:26:00 +0000 (08:26 +0200)
The libssh API uses a 32 bit type for datestamp, so instead of just
force-typecast it, make sure it gets capped at UINT_MAX if the value is
larger.

Reported-by: Joshua Rogers
Closes #18989

lib/vssh/libssh.c

index 579eaeaa0ded962f0c573635e44e75851e5dfe75..544e682b771e261a5140cbad89e284bce8664dcd 100644 (file)
@@ -1864,6 +1864,9 @@ static int myssh_in_SFTP_QUOTE_STAT(struct Curl_easy *data,
       sshc->actualcode = CURLE_QUOTE_ERROR;
       return SSH_NO_ERROR;
     }
+    if(date > UINT_MAX)
+      /* because the liubssh API can't deal with a larger value */
+      date = UINT_MAX;
     if(!strncmp(cmd, "atime", 5))
       sshc->quote_attrs->atime = (uint32_t)date;
     else /* mtime */