summaryrefslogtreecommitdiff
path: root/usr.sbin/hoststated/parse.y
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin/hoststated/parse.y')
-rw-r--r--usr.sbin/hoststated/parse.y15
1 files changed, 10 insertions, 5 deletions
diff --git a/usr.sbin/hoststated/parse.y b/usr.sbin/hoststated/parse.y
index d970d01e43f..88c1c1c93a1 100644
--- a/usr.sbin/hoststated/parse.y
+++ b/usr.sbin/hoststated/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.43 2007/05/29 00:21:10 pyr Exp $ */
+/* $OpenBSD: parse.y,v 1.44 2007/05/29 00:48:04 pyr Exp $ */
/*
* Copyright (c) 2006 Pierre-Yves Ritschard <pyr@spootnik.org>
@@ -558,8 +558,9 @@ proto : PROTO STRING {
p->type = RELAY_PROTO_TCP;
p->tcpflags = TCPFLAG_DEFAULT;
p->sslflags = SSLFLAG_DEFAULT;
- p->sslciphers = NULL;
p->tcpbacklog = RELAY_BACKLOG;
+ (void)strlcpy(p->sslciphers, SSLCIPHERS_DEFAULT,
+ sizeof(p->sslciphers));
if (last_proto_id == INT_MAX) {
yyerror("too many protocols defined");
YYERROR;
@@ -712,9 +713,13 @@ sslflags_l : sslflags comma sslflags_l
sslflags : SESSION CACHE sslcache { proto->cache = $3; }
| CIPHERS STRING {
- proto->sslciphers = strdup($2);
- if (proto->sslciphers == NULL)
- fatal("out of memory");
+ if (strlcpy(proto->sslciphers, $2,
+ sizeof(proto->sslciphers)) >=
+ sizeof(proto->sslciphers)) {
+ yyerror("sslciphers truncated");
+ free($2);
+ YYERROR;
+ }
free($2);
}
| NO flag { proto->sslflags &= ~($2); }