Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/btrCore.c
Original file line number Diff line number Diff line change
Expand Up @@ -7258,7 +7258,7 @@ btrCore_BTAdapterStatusUpdateCb (
return -1;
}

memset(&lstAdapterInfo, 0, sizeof(stBTRCoreAdapter));
memset(&lstAdapterInfo, 0, 10*sizeof(stBTRCoreAdapter));
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

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

lstAdapterInfo is a single stBTRCoreAdapter stack variable, but this memset zeros 10 * sizeof(stBTRCoreAdapter) bytes, which will write past the end of the object and corrupt the stack. Use sizeof(lstAdapterInfo) (or sizeof(stBTRCoreAdapter)) for the size argument; multiplying by 10 is unsafe and incorrect here.

Suggested change
memset(&lstAdapterInfo, 0, 10*sizeof(stBTRCoreAdapter));
memset(&lstAdapterInfo, 0, sizeof(lstAdapterInfo));

Copilot uses AI. Check for mistakes.
lstAdapterInfo.adapter_number = atoi(apstBTAdapterInfo->pcPath + pathlen-1);

BTRCORELOG_INFO ("adapter number = %d, path = %s, discovering = %d\n",
Expand Down
Loading