diff options
author | Henning Brauer <henning@cvs.openbsd.org> | 2004-01-28 23:49:56 +0000 |
---|---|---|
committer | Henning Brauer <henning@cvs.openbsd.org> | 2004-01-28 23:49:56 +0000 |
commit | 8c40da6ce09705ba6c14afaae59329b7701bc8f4 (patch) | |
tree | 56846487798ca7d24ad0b8b173ddd49383f8c3bc /usr.sbin/bgpd | |
parent | 071c8f2fffb345652c7592353547999d4d06bb78 (diff) |
properly whine when password is too long instead of silently truncating
Diffstat (limited to 'usr.sbin/bgpd')
-rw-r--r-- | usr.sbin/bgpd/parse.y | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/usr.sbin/bgpd/parse.y b/usr.sbin/bgpd/parse.y index d2c027faa69..c0665585770 100644 --- a/usr.sbin/bgpd/parse.y +++ b/usr.sbin/bgpd/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.43 2004/01/28 23:31:28 henning Exp $ */ +/* $OpenBSD: parse.y,v 1.44 2004/01/28 23:49:55 henning Exp $ */ /* * Copyright (c) 2002, 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -344,8 +344,13 @@ peeropts : REMOTEAS number { curpeer->conf.max_prefix = $2; } | TCP MD5SIG PASSWORD string { - strlcpy(curpeer->conf.tcp_md5_key, $4, - sizeof(curpeer->conf.tcp_md5_key)); + if (strlcpy(curpeer->conf.tcp_md5_key, $4, + sizeof(curpeer->conf.tcp_md5_key)) >= + sizeof(curpeer->conf.tcp_md5_key)) { + yyerror("tcp md5sig password too long: max %u", + sizeof(curpeer->conf.tcp_md5_key) - 1); + YYERROR; + } } | TCP MD5SIG KEY string { unsigned i; |