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

Ensure temporary files are given legal filenames #126

Merged
merged 1 commit into from
Jan 28, 2025

Conversation

carlonluca
Copy link
Contributor

The short_file value for some URLs may result in the string "/". For example, this URL:

http://te-home.net/?do=hublist&get=hublist.config.bz2

results in:

short_file: /
full_file: /?do=hublist&get=hublist.config.bz2

this makes it impossible to save the file. With this change, a random file name is chosen.

The short_file value for some URLs may result in the string "/". For
example, this URL:

http://te-home.net/?do=hublist&get=hublist.config.bz2

results in:

short_file: /
full_file: /?do=hublist&get=hublist.config.bz2

this makes it impossible to save the file. With this change, a random
file name is chosen.
Comment on lines 441 to 442
let prng = Random.State.make_self_init () in
let rnd = (Random.State.bits prng) land 0xFFFFFF in
Copy link
Owner

Choose a reason for hiding this comment

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

really strange why it just doesn't call Random.int
or even better - use mkstemps

@ygrek ygrek merged commit 0d44635 into ygrek:master Jan 28, 2025
13 of 15 checks passed
carlonluca added a commit to carlonluca/mldonkey that referenced this pull request Jan 31, 2025
The short_file value for some URLs may result in the string "/". For
example, this URL:

http://te-home.net/?do=hublist&get=hublist.config.bz2

results in:

short_file: /
full_file: /?do=hublist&get=hublist.config.bz2

this makes it impossible to save the file. With this change, a random
file name is chosen.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants