diff options
author | 2014-01-09 14:05:55 +0000 | |
---|---|---|
committer | 2014-01-09 14:05:55 +0000 | |
commit | 6f63102103f8ef3238260ac53efb7f86edd0c6ac (patch) | |
tree | 1bc853cde99867df3606c55eecbe927a1e8a6c1d | |
parent | Style and comment fixes from Tiago Cunha. (diff) | |
download | wireguard-openbsd-6f63102103f8ef3238260ac53efb7f86edd0c6ac.tar.xz wireguard-openbsd-6f63102103f8ef3238260ac53efb7f86edd0c6ac.zip |
Three small changes from Tiago Cunha:
- Check for truncation when copying path.
- Don't need to use a temporary buffer in screen_set_title.
- Include strerror in output when connecting to server fails.
-rw-r--r-- | usr.bin/tmux/client.c | 5 | ||||
-rw-r--r-- | usr.bin/tmux/screen.c | 8 | ||||
-rw-r--r-- | usr.bin/tmux/tmux.c | 8 |
3 files changed, 11 insertions, 10 deletions
diff --git a/usr.bin/tmux/client.c b/usr.bin/tmux/client.c index db938a082fc..0d0aeac405d 100644 --- a/usr.bin/tmux/client.c +++ b/usr.bin/tmux/client.c @@ -1,4 +1,4 @@ -/* $OpenBSD: client.c,v 1.76 2013/11/13 20:43:36 benno Exp $ */ +/* $OpenBSD: client.c,v 1.77 2014/01/09 14:05:55 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -232,7 +232,8 @@ client_main(int argc, char **argv, int flags) /* Initialise the client socket and start the server. */ fd = client_connect(socket_path, cmdflags & CMD_STARTSERVER); if (fd == -1) { - fprintf(stderr, "failed to connect to server\n"); + fprintf(stderr, "failed to connect to server: %s\n", + strerror(errno)); return (1); } diff --git a/usr.bin/tmux/screen.c b/usr.bin/tmux/screen.c index 408c2818f18..8a571b30e5e 100644 --- a/usr.bin/tmux/screen.c +++ b/usr.bin/tmux/screen.c @@ -1,4 +1,4 @@ -/* $OpenBSD: screen.c,v 1.26 2013/05/15 15:39:51 nicm Exp $ */ +/* $OpenBSD: screen.c,v 1.27 2014/01/09 14:05:55 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -110,12 +110,8 @@ screen_set_cursor_colour(struct screen *s, const char *colour_string) void screen_set_title(struct screen *s, const char *title) { - char tmp[BUFSIZ]; - - strlcpy(tmp, title, sizeof tmp); - free(s->title); - s->title = xstrdup(tmp); + s->title = xstrdup(title); } /* Resize screen. */ diff --git a/usr.bin/tmux/tmux.c b/usr.bin/tmux/tmux.c index 23aab622f1e..03a07c0af79 100644 --- a/usr.bin/tmux/tmux.c +++ b/usr.bin/tmux/tmux.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tmux.c,v 1.126 2013/10/10 12:29:35 nicm Exp $ */ +/* $OpenBSD: tmux.c,v 1.127 2014/01/09 14:05:55 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -361,7 +361,11 @@ main(int argc, char **argv) } } free(label); - strlcpy(socket_path, path, sizeof socket_path); + + if (strlcpy(socket_path, path, sizeof socket_path) >= sizeof socket_path) { + fprintf(stderr, "socket path too long: %s\n", path); + exit(1); + } free(path); /* Set process title. */ |