summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2014-02-24 15:57:22 +1100
committerDamien Miller <djm@mindrot.org>2014-02-24 15:57:22 +1100
commitbee3a234f3d1ad4244952bcff1b4b7c525330dc2 (patch)
treee3f5fe82137543252f9adf7e92f7895bd367d687
parent0628780abe61e7e50cba48cdafb1837f49ff23b2 (diff)
- 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...
-rw-r--r--ChangeLog4
-rw-r--r--ssh-ed25519.c8
2 files changed, 11 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index a5cb06484..e05b8698c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -12,6 +12,10 @@
12 [readconf.c] 12 [readconf.c]
13 when processing Match blocks, skip 'exec' clauses if previous predicates 13 when processing Match blocks, skip 'exec' clauses if previous predicates
14 failed to match; ok markus@ 14 failed to match; ok markus@
15 - djm@cvs.openbsd.org 2014/02/23 20:03:42
16 [ssh-ed25519.c]
17 check for unsigned overflow; not reachable in OpenSSH but others might
18 copy our code...
15 19
1620140213 2020140213
17 - (dtucker) [configure.ac openbsd-compat/openssl-compat.{c,h}] Add compat 21 - (dtucker) [configure.ac openbsd-compat/openssl-compat.{c,h}] Add compat
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 @@
1/* $OpenBSD: ssh-ed25519.c,v 1.2 2014/02/02 03:44:31 djm Exp $ */ 1/* $OpenBSD: ssh-ed25519.c,v 1.3 2014/02/23 20:03:42 djm Exp $ */
2/* 2/*
3 * Copyright (c) 2013 Markus Friedl <markus@openbsd.org> 3 * Copyright (c) 2013 Markus Friedl <markus@openbsd.org>
4 * 4 *
@@ -21,6 +21,7 @@
21 21
22#include "crypto_api.h" 22#include "crypto_api.h"
23 23
24#include <limits.h>
24#include <string.h> 25#include <string.h>
25#include <stdarg.h> 26#include <stdarg.h>
26 27
@@ -45,6 +46,11 @@ ssh_ed25519_sign(const Key *key, u_char **sigp, u_int *lenp,
45 error("%s: no ED25519 key", __func__); 46 error("%s: no ED25519 key", __func__);
46 return -1; 47 return -1;
47 } 48 }
49
50 if (datalen >= UINT_MAX - crypto_sign_ed25519_BYTES) {
51 error("%s: datalen %u too long", __func__, datalen);
52 return -1;
53 }
48 smlen = slen = datalen + crypto_sign_ed25519_BYTES; 54 smlen = slen = datalen + crypto_sign_ed25519_BYTES;
49 sig = xmalloc(slen); 55 sig = xmalloc(slen);
50 56