-/* $OpenBSD: control.c,v 1.76 2015/02/09 11:37:31 claudio Exp $ */
+/* $OpenBSD: control.c,v 1.77 2015/04/26 20:12:03 benno Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
bzero(&sun, sizeof(sun));
sun.sun_family = AF_UNIX;
- strlcpy(sun.sun_path, path, sizeof(sun.sun_path));
+ if (strlcpy(sun.sun_path, path, sizeof(sun.sun_path)) >=
+ sizeof(sun.sun_path)) {
+ log_warn("control_init: socket name too long");
+ close(fd);
+ return (-1);
+ }
if (unlink(path) == -1)
if (errno != ENOENT) {
-/* $OpenBSD: parse.y,v 1.279 2015/04/25 15:28:18 phessler Exp $ */
+/* $OpenBSD: parse.y,v 1.280 2015/04/26 20:12:03 benno Exp $ */
/*
* Copyright (c) 2002, 2003, 2004 Henning Brauer <henning@openbsd.org>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/stat.h>
+#include <sys/un.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netmpls/mpls.h>
conf->connectretry = $2;
}
| SOCKET STRING restricted {
+ if (strlen($2) >=
+ sizeof(((struct sockaddr_un *)0)->sun_path)) {
+ yyerror("socket path too long");
+ YYERROR;
+ }
if ($3) {
free(conf->rcsock);
conf->rcsock = $2;