diff options
author | Pauli <paul.dale@oracle.com> | 2017-07-06 14:56:20 +1000 |
---|---|---|
committer | Pauli <paul.dale@oracle.com> | 2017-07-07 15:45:55 +1000 |
commit | a2371fa93365cc0bc0e46b9d65f3a47a074b1c30 (patch) | |
tree | c4751256bc9a1e3d2b20bad3becd6b17aec2c9f4 /crypto/des | |
parent | a7ff57965b81ce4fd73a18266ce29abf6b909fdb (diff) |
Trivial bounds checking.
Bounds checking strpy, strcat and sprintf.
These are the remaining easy ones to cover a recently removed commit.
Some are trivial, some have been modified and a couple left as they are because the reverted change didn't bounds check properly.
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3871)
Diffstat (limited to 'crypto/des')
-rw-r--r-- | crypto/des/ecb_enc.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/crypto/des/ecb_enc.c b/crypto/des/ecb_enc.c index 0b292a2115..5ed079d15f 100644 --- a/crypto/des/ecb_enc.c +++ b/crypto/des/ecb_enc.c @@ -1,5 +1,5 @@ /* - * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 1995-2017 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -15,19 +15,16 @@ const char *DES_options(void) { static int init = 1; - static char buf[32]; + static char buf[12]; if (init) { - const char *size; - if (sizeof(DES_LONG) != sizeof(long)) - size = "int"; + OPENSSL_strlcpy(buf, "des(int)", sizeof(buf)); else - size = "long"; - sprintf(buf, "des(%s)", size); + OPENSSL_strlcpy(buf, "des(long)", sizeof(buf)); init = 0; } - return (buf); + return buf; } void DES_ecb_encrypt(const_DES_cblock *input, DES_cblock *output, |