summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordjm@openbsd.org <djm@openbsd.org>2024-08-20 13:10:04 +0200
committerDamien Miller <djm@mindrot.org>2024-08-20 13:11:38 +0200
commit2b1762115481ff2b7a60fd4db2ae69b725437462 (patch)
tree3a94fce49139ca981f29c26bf138b30df489d619
parentprivate key coredump protection for Linux/FreeBSD (diff)
downloadopenssh-2b1762115481ff2b7a60fd4db2ae69b725437462.tar.xz
openssh-2b1762115481ff2b7a60fd4db2ae69b725437462.zip
upstream: actually use the length parameter that was passed in rather
than a constant (this makes no difference in practice because the length is always the same); reported by martin AT nmkd.net OpenBSD-Commit-ID: 4aecce232c2fe9b16e9217ff6bcb3c848d853e7e
-rw-r--r--sshkey.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/sshkey.c b/sshkey.c
index 384fb59b0..7d8567404 100644
--- a/sshkey.c
+++ b/sshkey.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sshkey.c,v 1.144 2024/08/20 03:48:30 djm Exp $ */
+/* $OpenBSD: sshkey.c,v 1.145 2024/08/20 11:10:04 djm Exp $ */
/*
* Copyright (c) 2000, 2001 Markus Friedl. All rights reserved.
* Copyright (c) 2008 Alexander von Gernler. All rights reserved.
@@ -747,15 +747,15 @@ sshkey_prekey_alloc(u_char **prekeyp, size_t len)
*prekeyp = NULL;
#if defined(MAP_CONCEAL)
- if ((prekey = mmap(NULL, SSHKEY_SHIELD_PREKEY_LEN, PROT_READ|PROT_WRITE,
+ if ((prekey = mmap(NULL, len, PROT_READ|PROT_WRITE,
MAP_ANON|MAP_PRIVATE|MAP_CONCEAL, -1, 0)) == MAP_FAILED)
return SSH_ERR_SYSTEM_ERROR;
#elif defined(MAP_NOCORE)
- if ((prekey = mmap(NULL, SSHKEY_SHIELD_PREKEY_LEN, PROT_READ|PROT_WRITE,
+ if ((prekey = mmap(NULL, len, PROT_READ|PROT_WRITE,
MAP_ANON|MAP_PRIVATE|MAP_NOCORE, -1, 0)) == MAP_FAILED)
return SSH_ERR_SYSTEM_ERROR;
#elif defined(MADV_DONTDUMP)
- if ((prekey = mmap(NULL, SSHKEY_SHIELD_PREKEY_LEN, PROT_READ|PROT_WRITE,
+ if ((prekey = mmap(NULL, len, PROT_READ|PROT_WRITE,
MAP_ANON|MAP_PRIVATE, -1, 0)) == MAP_FAILED)
return SSH_ERR_SYSTEM_ERROR;
(void)madvise(prekey, len, MADV_DONTDUMP);