GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Fix #881, check overlap before calling strcpy in cJSON_SetValuestring by vwvw · Pull Request #885 · DaveGamble/cJSON

Conversation

@vwvw

@vwvw vwvw commented Aug 23, 2024

Copy link
Copy Markdown
Contributor

Add a check to be sure that the string don't overlap to avoid issues with strcpy.
Fixes #881

All the credit goes to @tregua87

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@vwvw
fix DaveGamble#881, check overlap before calling strcpy in cJSON_SetV…
d3b2452
…aluestring
@PeterAlfredLee

PeterAlfredLee commented Aug 24, 2024

Copy link
Copy Markdown
Contributor

LGTM
It will be appreciated if you can also add some tests.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

vwvw added 2 commits August 25, 2024 22:32
@vwvw
CJSON_SetValuestring: add test for overlapping string
193cd6a
@vwvw
CJSON_SetValuestring: better test for overlapping string
f0c6455
@vwvw

vwvw commented Aug 25, 2024

Copy link
Copy Markdown
Contributor Author

Added a test, let me know how it looks.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Alanscut

Alanscut commented Aug 26, 2024

Copy link
Copy Markdown
Collaborator

Valgrind reports.
Looks you forgot about the memory free in tests.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vwvw
Free mem in cjson_set_valuestring_should_return_null_if_strings_overlap
3f09bd6
@vwvw

vwvw commented Aug 27, 2024

Copy link
Copy Markdown
Contributor Author

Pushed the necessary fix to make valgrind happy again!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Alanscut
Alanscut merged commit 078c4e6 into DaveGamble:master Aug 30, 2024
This was referenced Sep 10, 2025
cjson: add version 1.7.19 conan-io/conan-center-index#28364
Merged
build(deps): Bump cJSON to 1.7.19 atsign-foundation/at_c#616
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

no overlap control in cJSON_SetValuestring

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@vwvw @PeterAlfredLee @Alanscut
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.