[PATCH 1/2] common: avoid segfault
Daniel Kahn Gillmor
dkg at fifthhorseman.net
Wed Oct 26 05:55:07 CEST 2016
* common/sysutils.c (gnupg_inotify_watch_socket): return EINVAL if
socket_name is NULL, rather than segfaulting
Signed-off-by: Daniel Kahn Gillmor <dkg at fifthhorseman.net>
---
common/sysutils.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/common/sysutils.c b/common/sysutils.c
index ab2012c..3677d39 100644
--- a/common/sysutils.c
+++ b/common/sysutils.c
@@ -987,6 +987,9 @@ gnupg_inotify_watch_socket (int *r_fd, const char *socket_name)
*r_fd = -1;
+ if (!socket_name)
+ return gpg_error (GPG_ERR_EINVAL);
+
fname = xtrystrdup (socket_name);
if (!fname)
return my_error_from_syserror ();
--
2.9.3
More information about the Gnupg-devel
mailing list