Skip to content

Fix parsing format to unsigned in FTP file stat - #8259

Closed
mdsnins wants to merge 2 commits into
php:masterfrom
mdsnins:fix1
Closed

mdsnins wants to merge 2 commits into
php:masterfrom
mdsnins:fix1

Conversation

@mdsnins

@mdsnins mdsnins commented Mar 28, 2022

Copy link
Copy Markdown
Contributor

ext/standard/ftp_fopen_wrapper.c:837

n = sscanf(p, "%4d%2d%2d%2d%2d%2d", &tm.tm_year, &tm.tm_mon, &tm.tm_mday, &tm.tm_hour, &tm.tm_min, &tm.tm_sec);

ext/ftp/ftp.c:1148

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);

Fix ftp_fopen_wrapper's format string to use identifier "%u"

@cmb69

cmb69 commented Mar 29, 2022

Copy link
Copy Markdown
Member

Thank you for the PR! However, it seems to me it should be the other way round, since POSIX specifies that the members of struct tm are of type int (and not unsigned). Current Windows headers also declare the members as int.

@mdsnins

mdsnins commented Apr 2, 2022

Copy link
Copy Markdown
Contributor Author

@cmb69 I understood. Then how about fixing ftp.c's unsigned one to signed one?

@cmb69

cmb69 commented Apr 2, 2022

Copy link
Copy Markdown
Member

Then how about fixing ftp.c's unsigned one to signed one?

Yes, I think that's the way to go. :)

@mdsnins

mdsnins commented Apr 2, 2022

Copy link
Copy Markdown
Contributor Author

I made a new commit to fix unsigned to signed. Thanks :)

@cmb69 cmb69 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! This looks good to me.

@ramsey ramsey added this to the PHP 8.2 milestone May 25, 2022
@ramsey ramsey closed this in af20923 May 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants