Fix datetime format string to follow POSIX spec in ftp_mdtm()

Closes GH-8259
This commit is contained in:
Jihwan Kim 2022-03-28 11:48:30 +09:00 committed by Ben Ramsey
parent 418ba5b3a7
commit af20923a0f
No known key found for this signature in database
GPG key ID: F9C39DC0B9698544
2 changed files with 4 additions and 1 deletions

3
NEWS
View file

@ -30,6 +30,9 @@ PHP NEWS
. Added support for listening queue on macOS. (David Carlier)
. Changed default for listen.backlog on Linux to -1. (Cristian Rodríguez)
- FTP:
. Fix datetime format string to follow POSIX spec in ftp_mdtm(). (Jihwan Kim)
- Intl:
. Update all grandfathered language tags with preferred values
. Fixed GH-7939 (Cannot unserialize IntlTimeZone objects). (cmb)

View file

@ -1145,7 +1145,7 @@ ftp_mdtm(ftpbuf_t *ftp, const char *path, const size_t path_len)
}
/* parse out the timestamp */
for (ptr = ftp->inbuf; *ptr && !isdigit(*ptr); ptr++);
n = sscanf(ptr, "%4u%2u%2u%2u%2u%2u", &tm.tm_year, &tm.tm_mon, &tm.tm_mday, &tm.tm_hour, &tm.tm_min, &tm.tm_sec);
n = sscanf(ptr, "%4d%2d%2d%2d%2d%2d", &tm.tm_year, &tm.tm_mon, &tm.tm_mday, &tm.tm_hour, &tm.tm_min, &tm.tm_sec);
if (n != 6) {
return -1;
}