Skip to content

Commit

Permalink
Coverity: fix WPrefs workspace negative array index read
Browse files Browse the repository at this point in the history
  • Loading branch information
dmaciejak authored and crmafra committed Mar 3, 2023
1 parent 7475bc5 commit d4ee17f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions WPrefs.app/Workspace.c
Original file line number Diff line number Diff line change
Expand Up @@ -207,12 +207,15 @@ static void createPanel(Panel * p)

static void storeData(_Panel * panel)
{
int tmp = WMGetPopUpButtonSelectedItem(panel->posP);

if (tmp < 0)
return;
SetBoolForKey(!WMGetButtonSelected(panel->linkB), "DontLinkWorkspaces");
SetBoolForKey(WMGetButtonSelected(panel->cyclB), "CycleWorkspaces");
SetBoolForKey(WMGetButtonSelected(panel->newB), "AdvanceToNewWorkspace");

SetStringForKey(WSNamePositions[WMGetPopUpButtonSelectedItem(panel->posP)],
"WorkspaceNameDisplayPosition");
SetStringForKey(WSNamePositions[tmp], "WorkspaceNameDisplayPosition");
}

Panel *InitWorkspace(WMWidget *parent)
Expand Down

0 comments on commit d4ee17f

Please sign in to comment.