- 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.
-/* $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>
/* 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);
}
-/* $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>
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. */
-/* $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>
}
}
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. */