common: avoid segfault
authorDaniel Kahn Gillmor <dkg@fifthhorseman.net>
Wed, 26 Oct 2016 03:55:07 +0000 (23:55 -0400)
committerNIIBE Yutaka <gniibe@fsij.org>
Wed, 26 Oct 2016 05:16:06 +0000 (14:16 +0900)
* common/sysutils.c (gnupg_inotify_watch_socket): return EINVAL if
  socket_name is NULL, rather than segfaulting
--
Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
common/sysutils.c

index ab2012c..ab3e1d6 100644 (file)
@@ -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 ();