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

fix inconsistent use of strlen in jl_load #16218

Merged
merged 1 commit into from
May 6, 2016

Conversation

stevengj
Copy link
Member

@stevengj stevengj commented May 5, 2016

I noticed that init.c was calling jl_load("boot.jl", sizeof("boot.jl")), which is wrong because the second argument is supposed to be the string length, but sizeof on a literal string is the string length + 1 to include the terminating NUL char.

Also, I noticed that the jl_parse_eval_all function wasn't actually using the len parameter in one place where it could have exploited it.

@stevengj
Copy link
Member Author

stevengj commented May 5, 2016

Hmm, I also notice another bug: the jl_load and jl_parse_eval_all functions take a len parameter, but don't check for embedded NUL chars before passing filenames to filesystem routines expecting NUL-terminated data. Hence, they silently truncate filename strings containing NUL chars.

jl_load can certainly check for this, but I wonder if the flisp tostring function should also check?

@JeffBezanson JeffBezanson merged commit 775dc82 into JuliaLang:master May 6, 2016
@stevengj stevengj deleted the jl_load_strlen branch May 6, 2016 14:18
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