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
This commit is contained in:
djm@openbsd.org 2019-07-09 04:15:00 +00:00 коммит произвёл Damien Miller
Родитель eb0b51dac4
Коммит 5b2b79ff7c
2 изменённых файлов: 6 добавлений и 3 удалений

Просмотреть файл

@ -1,4 +1,4 @@
/* $OpenBSD: auth-options.c,v 1.85 2019/06/27 18:03:37 deraadt Exp $ */ /* $OpenBSD: auth-options.c,v 1.86 2019/07/09 04:15:00 djm Exp $ */
/* /*
* Copyright (c) 2018 Damien Miller <djm@mindrot.org> * Copyright (c) 2018 Damien Miller <djm@mindrot.org>
* *
@ -320,7 +320,7 @@ handle_permit(const char **optsp, int allow_bare_port,
size_t npermits = *npermitsp; size_t npermits = *npermitsp;
const char *errstr = "unknown error"; const char *errstr = "unknown error";
if (npermits > INT_MAX) { if (npermits > SSH_AUTHOPT_PERMIT_MAX) {
*errstrp = "too many permission directives"; *errstrp = "too many permission directives";
return -1; return -1;
} }

Просмотреть файл

@ -1,4 +1,4 @@
/* $OpenBSD: auth-options.h,v 1.27 2018/06/06 18:23:32 djm Exp $ */ /* $OpenBSD: auth-options.h,v 1.28 2019/07/09 04:15:00 djm Exp $ */
/* /*
* Copyright (c) 2018 Damien Miller <djm@mindrot.org> * Copyright (c) 2018 Damien Miller <djm@mindrot.org>
@ -22,6 +22,9 @@
struct passwd; struct passwd;
struct sshkey; struct sshkey;
/* Maximum number of permitopen/permitlisten directives to accept */
#define SSH_AUTHOPT_PERMIT_MAX 4096
/* /*
* sshauthopt represents key options parsed from authorized_keys or * sshauthopt represents key options parsed from authorized_keys or
* from certificate extensions/options. * from certificate extensions/options.