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

ps.map: Fix copy into fixed size buffer issue in do_scalebar.c file #4307

Merged
merged 7 commits into from
Sep 12, 2024

Conversation

ShubhamDesai
Copy link
Contributor

This pull request resolves a buffer overflow issue detected by Coverity Scan (CID 1208259).
strcpy is replaced with G_strlcpy

@github-actions github-actions bot added C Related code is in C module labels Sep 11, 2024
ps/ps.map/do_scalebar.c Outdated Show resolved Hide resolved
ps/ps.map/do_scalebar.c Outdated Show resolved Hide resolved
ShubhamDesai and others added 2 commits September 11, 2024 19:30
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Copy link
Contributor

@nilason nilason left a comment

Choose a reason for hiding this comment

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

Besides the inline comment, there is only one minor suggestion:

You have, in this case correctly decided, to silence most of the return values with void, I think you can do the same with the remaining one.

The value of

int G_database_unit(void)

is guaranteed to fit into a buffer of size 50.

ps/ps.map/do_scalebar.c Outdated Show resolved Hide resolved
@ShubhamDesai
Copy link
Contributor Author

Besides the inline comment, there is only one minor suggestion:

You have, in this case correctly decided, to silence most of the return values with void, I think you can do the same with the remaining one.

The value of

int G_database_unit(void)

is guaranteed to fit into a buffer of size 50.

Done

@nilason nilason added this to the 8.5.0 milestone Sep 12, 2024
@nilason nilason enabled auto-merge (squash) September 12, 2024 21:03
@nilason nilason merged commit d77f457 into OSGeo:main Sep 12, 2024
26 checks passed
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C Related code is in C module
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants