diff --git a/src/unix-manager.c b/src/unix-manager.c index 71ef3802ff..07f99268c0 100644 --- a/src/unix-manager.c +++ b/src/unix-manager.c @@ -140,11 +140,21 @@ int UnixNew(UnixCommand * this) SCLogInfo("Using unix socket file '%s'", sockettarget); } if (sockettarget == NULL) { + struct stat stat_buf; + /* coverity[toctou] */ + if (stat(SOCKET_PATH, &stat_buf) != 0) { + SCLogWarning(SC_ERR_INITIALIZATION, + "Unix socket: problem with requested directory in %s: %s", + SOCKET_TARGET, strerror(errno)); + return 0; + } sockettarget = SCStrdup(SOCKET_TARGET); if (unlikely(sockettarget == NULL)) { SCLogError(SC_ERR_MEM_ALLOC, "Unable to allocate socket name"); return 0; } + + } /* Remove socket file */