SonarCloudにBugだと言われている範囲外アクセスに対処する #1595
Merged
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.
PR の目的
SonarScanで検出されたBugsレベル警告に対処します。
カテゴリ
PR の背景
SonarCloudで以下のようなBugsレベル警告が検出されています。
PR のメリット
SonarCloudのBugsレベル警告が3つ解消します。
PR のデメリット (トレードオフとかあれば)
とくにありません。
パフォーマンス問題は、気付かなかったことにします。
仕様・動作説明
文字列末尾に1文字追加してNUL終端するコードが指摘されています。
👇
追加したい1文字のみで構成される「文字列」を用意してstrcatします。
PR の影響範囲
テスト内容
ビルド確認のみです。
関連 issue, PR
#1504
参考資料