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

main: Handle empty HOME, HOMEDRIVE, and HOMEPATH envvar #2385

Closed

Conversation

masatake
Copy link
Member

See #2384 (comment) .

No test case. I cannot find a way to write a test case for Tmain easily.

@coveralls
Copy link

coveralls commented Dec 23, 2019

Coverage Status

Coverage increased (+0.0007%) to 86.374% when pulling 41bb8fb on masatake:handle-empty-HOME-envvar into e216bb4 on universal-ctags:master.

@masatake masatake changed the title Handle empty home envvar main: Handle empty HOME, HOMEDRIVE, and HOMEPATH envvar Dec 23, 2019
@masatake masatake requested a review from k-takata December 23, 2019 14:05
@masatake
Copy link
Member Author

masatake commented Dec 23, 2019

@k-takata, could you look into
41bb8fb ?

Suggested by @itchyny in universal-ctags#2384.

When $HOME is set but it is an empty string,
…d file name

combinePathAndFile takes two C strings.
The first one PATH was used in an expression: path [strlen(path) - 1] .
If PATH is an empty, this can cause a buffer overrun.

This change adds a guard-condition for such processing.

Inspired from the comment submitted by @itchyny in universal-ctags#2384.
@masatake masatake force-pushed the handle-empty-HOME-envvar branch from 610d1fe to 41bb8fb Compare December 23, 2019 14:07
@codecov-io
Copy link

Codecov Report

Merging #2385 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2385      +/-   ##
==========================================
+ Coverage   86.25%   86.25%   +<.01%     
==========================================
  Files         176      176              
  Lines       35740    35742       +2     
==========================================
+ Hits        30828    30830       +2     
  Misses       4912     4912
Impacted Files Coverage Δ
main/routines.c 81.11% <100%> (+0.14%) ⬆️
main/options.c 82.42% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e216bb4...41bb8fb. Read the comment docs.

@masatake
Copy link
Member Author

I unified this pull request and #2384 into #2386.

@masatake masatake closed this Dec 25, 2019
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.

3 participants