Skip to content

Commit

Permalink
Fixed segfault on XCBGetWMClass Failure in managereply() (#74)
Browse files Browse the repository at this point in the history
  • Loading branch information
DerjenigeUberMensch authored May 19, 2024
1 parent 18c391e commit acf82d6
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions dwm.c
Original file line number Diff line number Diff line change
Expand Up @@ -1357,7 +1357,8 @@ managereply(XCBWindow win, XCBCookie requests[MANAGE_CLIENT_COOKIE_COUNT])
XCBSizeHints hints;
u8 hintstatus = 0;
XCBWMHints *wmh = NULL;
XCBWMClass cls = { ._reply = NULL }; /* no safeguards for failure */
XCBWMClass cls = { ._reply = NULL };
u8 clsstatus = 0;
XCBWMProtocols wmprotocols = { ._reply = NULL, .atoms_len = 0 };
u8 wmprotocolsstatus = 0;
XCBWindowProperty *strutpreply = NULL;
Expand All @@ -1382,7 +1383,7 @@ managereply(XCBWindow win, XCBCookie requests[MANAGE_CLIENT_COOKIE_COUNT])
stateunused = XCBGetWindowPropertyReply(_wm.dpy, requests[4]);
hintstatus = XCBGetWMNormalHintsReply(_wm.dpy, requests[5], &hints);
wmh = XCBGetWMHintsReply(_wm.dpy, requests[6]);
XCBGetWMClassReply(_wm.dpy, requests[7], &cls);
clsstatus = XCBGetWMClassReply(_wm.dpy, requests[7], &cls);
wmprotocolsstatus = XCBGetWMProtocolsReply(_wm.dpy, requests[8], &wmprotocols);
strutpreply = XCBGetWindowPropertyReply(_wm.dpy, requests[9]);
strutreply = XCBGetWindowPropertyReply(_wm.dpy, requests[10]);
Expand Down Expand Up @@ -1432,7 +1433,9 @@ managereply(XCBWindow win, XCBCookie requests[MANAGE_CLIENT_COOKIE_COUNT])
setshowdecor(c, showdecor);
updatetitle(c, netwmname, wmname);
updatesizehints(c, &hints);
updateclass(c, &cls);
if(clsstatus)
{ updateclass(c, &cls);
}
updatewmhints(c, wmh);
updateicon(c, iconreply);
XCBSelectInput(_wm.dpy, win, inputmask);
Expand Down

0 comments on commit acf82d6

Please sign in to comment.