projects
/
tinc
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
test/splice.c: reformat with astyle
[tinc]
/
src
/
tincctl.c
diff --git
a/src/tincctl.c
b/src/tincctl.c
index
97b08cb
..
8b49c44
100644
(file)
--- a/
src/tincctl.c
+++ b/
src/tincctl.c
@@
-853,14
+853,17
@@
bool connect_tincd(bool verbose) {
return false;
}
return false;
}
- struct sockaddr_un sa;
+ struct sockaddr_un sa = {
+ .sun_family = AF_UNIX,
+ };
- sa.sun_family = AF_UNIX;
+ if(strlen(unixsocketname) >= sizeof(sa.sun_path)) {
+ fprintf(stderr, "UNIX socket filename %s is too long!", unixsocketname);
+ return false;
+ }
strncpy(sa.sun_path, unixsocketname, sizeof(sa.sun_path));
strncpy(sa.sun_path, unixsocketname, sizeof(sa.sun_path));
- sa.sun_path[sizeof(sa.sun_path) - 1] = 0;
-
fd = socket(AF_UNIX, SOCK_STREAM, 0);
if(fd < 0) {
fd = socket(AF_UNIX, SOCK_STREAM, 0);
if(fd < 0) {
@@
-1107,7
+1110,7
@@
static int cmd_stop(int argc, char *argv[]) {
}
#ifdef HAVE_MINGW
}
#ifdef HAVE_MINGW
- return remove_service();
+ return remove_service()
? EXIT_SUCCESS : EXIT_FAILURE
;
#else
if(!stop_tincd()) {
#else
if(!stop_tincd()) {