diff options
author | Damien Miller <djm@mindrot.org> | 2014-02-24 05:57:22 +0100 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2014-02-24 05:57:22 +0100 |
commit | bee3a234f3d1ad4244952bcff1b4b7c525330dc2 (patch) | |
tree | e3f5fe82137543252f9adf7e92f7895bd367d687 /ssh-ed25519.c | |
parent | - djm@cvs.openbsd.org 2014/02/22 01:32:19 (diff) | |
download | openssh-bee3a234f3d1ad4244952bcff1b4b7c525330dc2.tar.xz openssh-bee3a234f3d1ad4244952bcff1b4b7c525330dc2.zip |
- djm@cvs.openbsd.org 2014/02/23 20:03:42
[ssh-ed25519.c]
check for unsigned overflow; not reachable in OpenSSH but others might
copy our code...
Diffstat (limited to '')
-rw-r--r-- | ssh-ed25519.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/ssh-ed25519.c b/ssh-ed25519.c index 56c480df2..160d1f23b 100644 --- a/ssh-ed25519.c +++ b/ssh-ed25519.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ssh-ed25519.c,v 1.2 2014/02/02 03:44:31 djm Exp $ */ +/* $OpenBSD: ssh-ed25519.c,v 1.3 2014/02/23 20:03:42 djm Exp $ */ /* * Copyright (c) 2013 Markus Friedl <markus@openbsd.org> * @@ -21,6 +21,7 @@ #include "crypto_api.h" +#include <limits.h> #include <string.h> #include <stdarg.h> @@ -45,6 +46,11 @@ ssh_ed25519_sign(const Key *key, u_char **sigp, u_int *lenp, error("%s: no ED25519 key", __func__); return -1; } + + if (datalen >= UINT_MAX - crypto_sign_ed25519_BYTES) { + error("%s: datalen %u too long", __func__, datalen); + return -1; + } smlen = slen = datalen + crypto_sign_ed25519_BYTES; sig = xmalloc(slen); |