Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix UUID String Handling in BLEUuid Class#348

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
Mankianer wants to merge1 commit intoarduino-libraries:master
base:master
Choose a base branch
Loading
fromMankianer:mankianer/fix-uuid-string-copy

Conversation

@Mankianer
Copy link

This pull request addresses a critical issue in the BLEUuid class where the UUID string was not being properly managed. The class was storing a pointer to the original string passed to it, which could lead to unexpected behavior if the original string was modified or went out of scope.

Changes made:

  1. The _str member of the BLEUuid class has been changed from a const char* to a char*. This allows us to modify the pointer and point it to a new string copy.
  2. In the BLEUuid constructor, we now create a copy of the string passed using the strdup function. This ensures that the BLEUuid class has its own copy of the UUID string, which remains valid even if the original string changes or goes out of scope.
  3. In the BLEUuid destructor, we free the memory allocated for the string copy. This prevents memory leaks when BLEUuid objects are destroyed.

These changes ensure that the BLEUuid class correctly manages its own copy of the UUID string, preventing potential issues caused by changes to the original string. This makes the BLEUuid class more robust and reliable in its handling of UUID strings.

This commit addresses an issue in the BLEUuid class where the UUID string was not being properly copied. Previously, the class stored a pointer to the original string, which could lead to issues if the original string was modified or went out of scope.The fix involves changing the _str member of the BLEUuid class to be a non-const char pointer, and using the strdup function to create a copy of the string in the BLEUuid constructor. The destructor of the BLEUuid class has also been updated to free the memory allocated for the string copy.This change ensures that the BLEUuid class has its own copy of the UUID string, preventing potential issues caused by changes to the original string.Signed-off-by: Mankianer <mankianer@gmail.com>
@CLAassistant
Copy link

CLAassistant commentedFeb 1, 2024
edited
Loading

CLA assistant check
All committers have signed the CLA.

@per1234per1234 added type: imperfectionPerceived defect in any part of project topic: codeRelated to content of the project itself labelsFeb 1, 2024
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

topic: codeRelated to content of the project itselftype: imperfectionPerceived defect in any part of project

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

3 participants

@Mankianer@CLAassistant@per1234

[8]ページ先頭

©2009-2025 Movatter.jp