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

Static analysis issues JSC 2.1 #93

Closed
2 tasks done
chillfig opened this issue May 28, 2024 · 0 comments · Fixed by #94
Closed
2 tasks done

Static analysis issues JSC 2.1 #93

chillfig opened this issue May 28, 2024 · 0 comments · Fixed by #94
Assignees
Labels

Comments

@chillfig
Copy link
Contributor

chillfig commented May 28, 2024

Checklist (Please check before submitting)

  • I reviewed the Contributing Guide.
  • I performed a cursory search to see if the bug report is relevant, not redundant, nor in conflict with other tickets.

Describe the bug
Handful of static analysis issues. This report records the findings from the static analysis to facilitate their tracking.

Source Folder Source Filename Source Line Source Object Disposition
Unsafe Functions        
\apps\cs\fsw\src cs_table_processing.c 234 strlen Will Fix. CS PR #94
\apps\cs\fsw\src cs_table_processing.c 360 strlen Will Fix. CS PR #94
Replace with snprintf        
\apps\cs\fsw\src cs_compute.c 540 strncpy Will Fix. CS PR #94
\apps\cs\fsw\src cs_init.c 45 strncpy Will Fix. CS PR #94
\apps\cs\fsw\src cs_table_processing.c 531 strncpy Will Fix. CS PR #94
\apps\cs\fsw\src cs_table_processing.c 828 strncpy Will Fix. CS PR #94
\apps\cs\fsw\src cs_table_processing.c 907 strncpy Will Fix. CS PR #94
\apps\cs\fsw\src cs_table_processing.c 911 strncpy Will Fix. CS PR #94
\apps\cs\fsw\src cs_table_processing.c 915 strncpy Will Fix. CS PR #94
\apps\cs\fsw\src cs_table_processing.c 919 strncpy Will Fix. CS PR #94
\apps\cs\fsw\src cs_table_processing.c 970 strncpy Will Fix. CS PR #94
\apps\cs\fsw\src cs_table_processing.c 1034 strncpy Will Fix. CS PR #94
\apps\cs\fsw\src cs_table_processing.c 1038 strncpy Will Fix. CS PR #94
\apps\cs\fsw\src cs_table_processing.c 1042 strncpy Will Fix. CS PR #94
\apps\cs\fsw\src cs_table_processing.c 1046 strncpy Will Fix. CS PR #94

To Reproduce
N/A. These issues were communicated by JSC.

Expected behavior
Need to resolve these. Should resolve and/or disposition the higher ranked ones at minimum.

Code snips
N/A

System observed on:
N/A

Additional context
Code is safe as-is.

  • The arguments of strlen is null-terminated and sized in cs/fsw/src/cs_table_processing.c::CS_ProcessNewAppDefinitionTable()
  • There is no need for fixes to strncpy regarding TableType since it is used to copy a string literal that is well within the bounds of TableType

However, the stakeholder insists on making comments in the code to rationalize "will not fix" and it is preferable to alternatively change the code to appease the static analysis tool findings. Therefore, will fix all as they make the code safer.

Reporter Info
Imported from JSC 2.1 static analysis
Source Folder Source Filename Source Line Source Object Disposition
Unsafe Functions
\apps\cs\fsw\src cs_table_processing.c 234 strlen Will Fix. CS PR #94

\apps\cs\fsw\src cs_table_processing.c 360 strlen Will Fix. CS PR #94

Replace with snprintf
\apps\cs\fsw\src cs_compute.c 540 strncpy Will Fix. CS PR #94

\apps\cs\fsw\src cs_init.c 45 strncpy Will Fix. CS PR #94

\apps\cs\fsw\src cs_table_processing.c 531 strncpy Will Fix. CS PR #94

\apps\cs\fsw\src cs_table_processing.c 828 strncpy Will Fix. CS PR #94

\apps\cs\fsw\src cs_table_processing.c 907 strncpy Will Fix. CS PR #94

\apps\cs\fsw\src cs_table_processing.c 911 strncpy Will Fix. CS PR #94

\apps\cs\fsw\src cs_table_processing.c 915 strncpy Will Fix. CS PR #94

\apps\cs\fsw\src cs_table_processing.c 919 strncpy Will Fix. CS PR #94

\apps\cs\fsw\src cs_table_processing.c 970 strncpy Will Fix. CS PR #94

\apps\cs\fsw\src cs_table_processing.c 1034 strncpy Will Fix. CS PR #94

\apps\cs\fsw\src cs_table_processing.c 1038 strncpy Will Fix. CS PR #94

\apps\cs\fsw\src cs_table_processing.c 1042 strncpy Will Fix. CS PR #94

\apps\cs\fsw\src cs_table_processing.c 1046 strncpy Will Fix. CS PR #94

@chillfig chillfig self-assigned this May 28, 2024
chillfig pushed a commit to chillfig/CS that referenced this issue Jun 6, 2024
chillfig pushed a commit to chillfig/CS that referenced this issue Jun 13, 2024
…nprintf

This commit addresses issues flagged during static analysis by:
- Adding JSC 2.1 disposition comments.
- Replacing strncpy with snprintf to enhance safety and compliance.
chillfig pushed a commit to chillfig/CS that referenced this issue Jun 14, 2024
This commit addresses issues flagged during static analysis by:
- Adding JSC 2.1 disposition comments.
- Replacing strncpy with snprintf to enhance safety and compliance.
- Replacing strlen with memchr to chance safety and compliance.
chillfig pushed a commit to chillfig/CS that referenced this issue Jun 17, 2024
This commit addresses issues flagged during static analysis by:
- Replacing strncpy with snprintf to enhance safety and compliance.
- Replacing strlen with memchr to chance safety and compliance.
chillfig pushed a commit to chillfig/CS that referenced this issue Jun 21, 2024
This commit addresses issues flagged during static analysis by:
- Replacing strncpy with snprintf to enhance safety and compliance.
- Replacing strlen with OS_strnlen to chance safety and compliance.
@dzbaker dzbaker closed this as completed in 8df0a4b Jul 2, 2024
dzbaker added a commit that referenced this issue Jul 2, 2024
Fix #93, Replaces strncpy and strlen
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant