Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

カスタムメニューの追加時に配列の範囲外を書き換えないようにする #1445

Merged
merged 1 commit into from Oct 28, 2020
Merged
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
カスタムメニュー関係の配列に対する範囲外アクセスを修正
  • Loading branch information
berryzplus authored and Kohki Akikaze committed Oct 28, 2020
commit 4b142236efbad5c076fd50e9e8b90410fada2a67
2 changes: 1 addition & 1 deletion sakura_core/prop/CPropComCustmenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ INT_PTR CPropCustmenu::DispatchEvent(
}
nNum2 = List_GetCount( hwndLIST_RES );
if( LB_ERR == nNum2 ){
nIdx2 = 0;
nNum2 = 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

LB_ERR = -1 だったと思います。

nNum2 == -1 のときに、nNum2を放置してnIdx2を更新してたってことですよね。

m_Common.m_sCustomMenu.m_nCustMenuItemFuncArr[nIdx1][nNum2] = eFuncCode;
m_Common.m_sCustomMenu.m_nCustMenuItemKeyArr[nIdx1][nNum2] = '\0';

これは明らかにダメな香りです。

}
nIdx3 = Combo_GetCurSel( hwndCOMBO_FUNCKIND );
if( CB_ERR == nIdx3 ){
Expand Down