[PATCH 09/17] fookb: Fix error handling when reading XPM files.
Doug Torrance <[email protected]> Sat, 9 Sep 2017 21:24:25 -0400
| Newsgroups | gmane.compw.window-managers.windowmaker.devel |
|---|---|
| Message-ID | <[email protected]> |
Previously, we would try and read the width and height of images read from
an XPM file *before* doing any error handling to determine whether we
successfully read the file in the first place. If there had been an error,
then there would be a segfault.
---
fookb/images.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/fookb/images.c b/fookb/images.c
index d052a30..8f24949 100644
--- a/fookb/images.c
+++ b/fookb/images.c
@@ -38,6 +38,9 @@ static int get_one_image(char *name, int index, Display *dpy)
foo = XpmReadFileToImage(dpy, name, &stupid_picture[index],
NULL, NULL);
+ if (foo < 0)
+ return foo;
+
if (0 == w) {
w = stupid_picture[index]->width;
if (0 == w) {
--
2.11.0
--
To unsubscribe, send mail to [email protected].