Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ftp: avoid risk of reading uninitialized integers #5972

Closed
wants to merge 1 commit into from

Conversation

bagder
Copy link
Member

@bagder bagder commented Sep 17, 2020

If the received PASV response doesn't match the expected pattern, we
could end up reading uninitialized integers for IP address and port
number.

Issue pointed out by muse.dev

If the received PASV response doesn't match the expected pattern, we
could end up reading uninitialized integers for IP address and port
number.

Issue pointed out by muse.dev
@bagder bagder added the FTP label Sep 17, 2020
Copy link
Contributor

@emilengler emilengler left a comment

Choose a reason for hiding this comment

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

Can't you use this initializer?
x[4] = { 0 }; to init everything?

@emilengler
Copy link
Contributor

@bagder
Copy link
Member Author

bagder commented Sep 18, 2020

That's a C99 feature that didn't exist in C89.

@emilengler
Copy link
Contributor

That's a C99 feature that didn't exist in C89.

Wow that fact just destroyed my universe. Anyway then go ahead!

@emilengler
Copy link
Contributor

Maybe write 0u instead of 0 though

@bagder
Copy link
Member Author

bagder commented Sep 18, 2020

I could, but personally I often sort of "react" a little on the extra letter like that and I prefer to go without it if I can. For this, I don't see the need to emphasize in the constant that it is an unsigned value. zero is still zero.

@bagder bagder closed this in 3d8731c Sep 18, 2020
@bagder bagder deleted the bagder/ftp-uninit-value branch September 18, 2020 06:30
@jay
Copy link
Member

jay commented Sep 18, 2020

That's a C99 feature that didn't exist in C89.

? No it's not and we use {0} elsewhere. It's fine either way though.

@bagder
Copy link
Member Author

bagder commented Sep 18, 2020

hm okay, thanks, then I stand corrected!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

None yet

3 participants