commit 1cabeda5505dcc35d4d2ca2a09151a7c449fb401 from: Hiltjo Posthuma date: Fri Nov 3 20:07:02 2017 UTC fix a possible free of a uninitialize variable in paste() commit - 41379f7c39e6aa0a17d7807b22b49ea148f5b0fa commit + 1cabeda5505dcc35d4d2ca2a09151a7c449fb401 blob - 91330f191f7b219aff9217c1e20bf51afeb769c4 blob + eae56850e37d6cf78b570a46b1f5abe57e3df563 --- dmenu.c +++ dmenu.c @@ -467,10 +467,12 @@ paste(void) Atom da; /* we have been given the current selection, now insert it into input */ - XGetWindowProperty(dpy, win, utf8, 0, (sizeof text / 4) + 1, False, - utf8, &da, &di, &dl, &dl, (unsigned char **)&p); - insert(p, (q = strchr(p, '\n')) ? q - p : (ssize_t)strlen(p)); - XFree(p); + if (XGetWindowProperty(dpy, win, utf8, 0, (sizeof text / 4) + 1, False, + utf8, &da, &di, &dl, &dl, (unsigned char **)&p) + == Success && p) { + insert(p, (q = strchr(p, '\n')) ? q - p : (ssize_t)strlen(p)); + XFree(p); + } drawmenu(); }