Skip to content

use std::strncpy#2834

Closed
salix5 wants to merge 2 commits into
Fluorohydride:masterfrom
salix5:patch43
Closed

use std::strncpy#2834
salix5 wants to merge 2 commits into
Fluorohydride:masterfrom
salix5:patch43

Conversation

@salix5

@salix5 salix5 commented Jun 10, 2025

Copy link
Copy Markdown
Collaborator

We should avoid strcpy.

@mercury233
@purerosefallen

@salix5 salix5 requested review from Copilot and purerosefallen June 10, 2025 15:10

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull Request Overview

This PR replaces unsafe strcpy/strncat calls with bounds-checked std::strncpy and updates snprintf to use sizeof for safer buffer handling.

  • Replace strcpy with std::strncpy and manual null-termination in SoundManager::PlaySoundEffect.
  • Update snprintf to use sizeof soundPath instead of hardcoded length.
  • Replace strncat pattern with std::strncpy and manual null-termination in DataManager::Error.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
gframe/sound_manager.cpp Swapped strcpy for std::strncpy + null-termination; updated snprintf to use sizeof.
gframe/data_manager.cpp Replaced strncat error construction with std::strncpy + null-termination.

Comment thread gframe/sound_manager.cpp
Comment thread gframe/sound_manager.cpp Outdated
Comment thread gframe/data_manager.cpp
@mercury233

Copy link
Copy Markdown
Collaborator

need tool function

@salix5

salix5 commented Jun 11, 2025

Copy link
Copy Markdown
Collaborator Author

will change later

@salix5 salix5 closed this Jun 11, 2025
@salix5 salix5 deleted the patch43 branch June 11, 2025 05:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants