summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordjm@openbsd.org <djm@openbsd.org>2019-07-09 04:15:00 +0000
committerDamien Miller <djm@mindrot.org>2019-07-09 14:20:15 +1000
commit5b2b79ff7c057ee101518545727ed3023372891d (patch)
tree73b104b883b87dbd00954199a16c1238d2a71299
parenteb0b51dac408fadd1fd13fa6d726ab8fdfcc4152 (diff)
upstream: cap the number of permiopen/permitlisten directives we're
willing to parse on a single authorized_keys line; ok deraadt@ OpenBSD-Commit-ID: a43a752c2555d26aa3fc754805a476f6e3e30f46
-rw-r--r--auth-options.c4
-rw-r--r--auth-options.h5
2 files changed, 6 insertions, 3 deletions
diff --git a/auth-options.c b/auth-options.c
index 4923a83b7..514221882 100644
--- a/auth-options.c
+++ b/auth-options.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: auth-options.c,v 1.85 2019/06/27 18:03:37 deraadt Exp $ */ 1/* $OpenBSD: auth-options.c,v 1.86 2019/07/09 04:15:00 djm Exp $ */
2/* 2/*
3 * Copyright (c) 2018 Damien Miller <djm@mindrot.org> 3 * Copyright (c) 2018 Damien Miller <djm@mindrot.org>
4 * 4 *
@@ -320,7 +320,7 @@ handle_permit(const char **optsp, int allow_bare_port,
320 size_t npermits = *npermitsp; 320 size_t npermits = *npermitsp;
321 const char *errstr = "unknown error"; 321 const char *errstr = "unknown error";
322 322
323 if (npermits > INT_MAX) { 323 if (npermits > SSH_AUTHOPT_PERMIT_MAX) {
324 *errstrp = "too many permission directives"; 324 *errstrp = "too many permission directives";
325 return -1; 325 return -1;
326 } 326 }
diff --git a/auth-options.h b/auth-options.h
index 0462983b5..14cbfa49d 100644
--- a/auth-options.h
+++ b/auth-options.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: auth-options.h,v 1.27 2018/06/06 18:23:32 djm Exp $ */ 1/* $OpenBSD: auth-options.h,v 1.28 2019/07/09 04:15:00 djm Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2018 Damien Miller <djm@mindrot.org> 4 * Copyright (c) 2018 Damien Miller <djm@mindrot.org>
@@ -22,6 +22,9 @@
22struct passwd; 22struct passwd;
23struct sshkey; 23struct sshkey;
24 24
25/* Maximum number of permitopen/permitlisten directives to accept */
26#define SSH_AUTHOPT_PERMIT_MAX 4096
27
25/* 28/*
26 * sshauthopt represents key options parsed from authorized_keys or 29 * sshauthopt represents key options parsed from authorized_keys or
27 * from certificate extensions/options. 30 * from certificate extensions/options.