Discussion:
[Xcb] [PATCH libxcb] Check strdup for NULL return value.
Tobias Stoeckmann
2017-03-26 13:41:12 UTC
Permalink
_xcb_open does not check strdup's return value for NULL if launchd suport
was configured.

Signed-off-by: Tobias Stoeckmann <***@stoeckmann.org>
---
src/xcb_util.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/src/xcb_util.c b/src/xcb_util.c
index a3357ef..a16270c 100644
--- a/src/xcb_util.c
+++ b/src/xcb_util.c
@@ -265,6 +265,8 @@ static int _xcb_open(const char *host, char *protocol, const int display)
struct stat sbuf;
if (0 == stat(host, &sbuf)) {
file = strdup(host);
+ if(file == NULL)
+ return -1;
filelen = actual_filelen = strlen(file);
} else
#endif
--
2.12.2
Uli Schlachter
2017-04-01 09:57:50 UTC
Permalink
Thanks, merged.
Post by Tobias Stoeckmann
_xcb_open does not check strdup's return value for NULL if launchd suport
was configured.
---
src/xcb_util.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/xcb_util.c b/src/xcb_util.c
index a3357ef..a16270c 100644
--- a/src/xcb_util.c
+++ b/src/xcb_util.c
@@ -265,6 +265,8 @@ static int _xcb_open(const char *host, char *protocol, const int display)
struct stat sbuf;
if (0 == stat(host, &sbuf)) {
file = strdup(host);
+ if(file == NULL)
+ return -1;
filelen = actual_filelen = strlen(file);
} else
#endif
--
"In the beginning the Universe was created. This has made a lot of
people very angry and has been widely regarded as a bad move."
Loading...