pinosaur
/
dmenu.git
/ commitdiff
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
41379f7
)
fix a possible free of a uninitialize variable in paste()
author
Hiltjo Posthuma
<hiltjo@codemadness.org>
Fri, 3 Nov 2017 14:31:37 +0000
(15:31 +0100)
committer
Hiltjo Posthuma
<hiltjo@codemadness.org>
Fri, 3 Nov 2017 20:07:02 +0000
(21:07 +0100)
dmenu.c
patch
|
blob
|
history
diff --git
a/dmenu.c
b/dmenu.c
index
91330f1
..
eae5685
100644
(file)
--- a/
dmenu.c
+++ b/
dmenu.c
@@
-467,10
+467,12
@@
paste(void)
Atom da;
/* we have been given the current selection, now insert it into input */
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();
}
drawmenu();
}