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

Unreachable code in fm_child.c, EntryLength never larger than sizeof(DirListData.EntryName) #44

Closed
3 tasks done
skliper opened this issue Aug 1, 2022 · 0 comments · Fixed by #45
Closed
3 tasks done
Assignees
Milestone

Comments

@skliper
Copy link
Contributor

skliper commented Aug 1, 2022

Checklist (Please check before submitting)

  • I reviewed the Contributing Guide.
  • I reviewed the README file to see if the feature is in the major future work.
  • I performed a cursory search to see if the feature request is relevant, not redundant, nor in conflict with other tickets.

Is your feature request related to a problem? Please describe.
Since both DirListData.EntryName and TempName are both OS_MAX_PATH_LENGTH, and and the os_dirent_t FileName is limited by OS_MAX_FILE_NAME, the first condition below can never be false:

if ((EntryLength < sizeof(DirListData.EntryName)) && ((PathLength + EntryLength) < OS_MAX_PATH_LEN))

Describe the solution you'd like
Remove, the second condition is sufficient (add comment)

Describe alternatives you've considered
None

Additional context
None

Requester Info
Jacob Hageman - NASA/GSFC

@skliper skliper added this to the Draco milestone Aug 1, 2022
@skliper skliper self-assigned this Aug 1, 2022
@dzbaker dzbaker closed this as completed in 20c3369 Aug 3, 2022
dzbaker added a commit that referenced this issue Aug 3, 2022
Fix #34 #37 #43 #44, UT cleanup, remove unreachable code, initialize FileMode on OS_stat failure
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants