diff options
author | 2004-01-28 23:49:55 +0000 | |
---|---|---|
committer | 2004-01-28 23:49:55 +0000 | |
commit | 046853d95c5ecd16d9936d15aa5891bc1e58e10b (patch) | |
tree | 45848d45cf73e5b74e2ca5a4e898eda6c017fc2d | |
parent | Better fix the typo for real, this time. Oops. (diff) | |
download | wireguard-openbsd-046853d95c5ecd16d9936d15aa5891bc1e58e10b.tar.xz wireguard-openbsd-046853d95c5ecd16d9936d15aa5891bc1e58e10b.zip |
properly whine when password is too long instead of silently truncating
-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; |