Repository navigation
Conversation
1. Root cause: fprintf strings in DBusEnableInterface and DBusWakeupInterface used /n and /t instead of \n and \t, causing error messages to display literal characters 2. Fix: replace /n with \n and /t with \t in both files; add local size() < 2 guard before pathList index access 3. Impact: error messages now format with proper newlines and tabs; bounds guard prevents potential out-of-bounds access Influence: 1. Test D-Bus connection failure error message formatting 2. Test wakeup device path with insufficient path segments 3. Verify normal D-Bus initialization has no regression fix: 修正fprintf转义符并增加边界检查 1. 根因:DBusEnableInterface 和 DBusWakeupInterface 的 fprintf 误用 /n 和 /t 代替 \n 和 \t,错误提示输出字面量不换行 2. 方案:将两处 fprintf 中 /n 改为 \n、/t 改为 \t;在 pathList 索引访问前增加 size() < 2 局部边界校验 3. 影响:错误提示恢复正常换行和缩进格式;局部边界检查 防止未来重构移除入口校验后的潜在越界访问 Influence: 1. 测试 D-Bus 连接失败时的错误提示格式 2. 测试路径分段不足时的唤醒设备处理 3. 验证正常 D-Bus 初始化流程无回归
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: add-uos The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Reviewer's guide (collapsed on small PRs)Reviewer's GuideThis PR fixes D-Bus connection error-message formatting by using valid newline and tab escapes, and hardens wakeup-device handling with a local pathList size guard before indexing. Sequence diagram for guarded wakeup device configurationsequenceDiagram
participant Caller
participant DBusWakeupInterface
participant InputInterface
Caller->>DBusWakeupInterface: setWakeupMachine(unique_id, wakeup)
DBusWakeupInterface->>DBusWakeupInterface: pathList.size()
alt pathList.size() < 2
DBusWakeupInterface-->>Caller: return false
else pathList has at least 2 segments
DBusWakeupInterface->>InputInterface: call(SetWakeupDevices, busPath, state)
end
Flow diagram for formatted D-Bus connection errorsflowchart TD
A[Initialize D-Bus interface] --> B{"systemBus().isConnected()"}
B -->|No| C[fprintf error with newline and tab escapes]
B -->|Yes| D[Create D-Bus interface]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
fix: correct fprintf escapes and add guard
DBusWakeupInterface used /n and /t instead of \n and \t,
causing error messages to display literal characters
local size() < 2 guard before pathList index access
tabs; bounds guard prevents potential out-of-bounds access
Influence:
fix: 修正fprintf转义符并增加边界检查
误用 /n 和 /t 代替 \n 和 \t,错误提示输出字面量不换行
pathList 索引访问前增加 size() < 2 局部边界校验
防止未来重构移除入口校验后的潜在越界访问
Influence:
Summary by Sourcery
Fix D-Bus error message formatting and prevent invalid wakeup-device path access.
Bug Fixes: