summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhenning <henning@openbsd.org>2004-01-28 23:49:55 +0000
committerhenning <henning@openbsd.org>2004-01-28 23:49:55 +0000
commit046853d95c5ecd16d9936d15aa5891bc1e58e10b (patch)
tree45848d45cf73e5b74e2ca5a4e898eda6c017fc2d
parentBetter fix the typo for real, this time. Oops. (diff)
downloadwireguard-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.y11
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;