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/rand | |
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/rand')
-rw-r--r-- | crypto/rand/rand_egd.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/crypto/rand/rand_egd.c b/crypto/rand/rand_egd.c index 3f812c6620..1b091e848c 100644 --- a/crypto/rand/rand_egd.c +++ b/crypto/rand/rand_egd.c @@ -56,17 +56,17 @@ NON_EMPTY_TRANSLATION_UNIT # if defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_VMS) || defined(OPENSSL_SYS_MSDOS) || defined(OPENSSL_SYS_VXWORKS) || defined(OPENSSL_SYS_VOS) || defined(OPENSSL_SYS_UEFI) int RAND_query_egd_bytes(const char *path, unsigned char *buf, int bytes) { - return (-1); + return -1; } int RAND_egd(const char *path) { - return (-1); + return -1; } int RAND_egd_bytes(const char *path, int bytes) { - return (-1); + return -1; } # else # include <openssl/opensslconf.h> @@ -101,12 +101,12 @@ int RAND_query_egd_bytes(const char *path, unsigned char *buf, int bytes) memset(&addr, 0, sizeof(addr)); addr.sun_family = AF_UNIX; if (strlen(path) >= sizeof(addr.sun_path)) - return (-1); + return -1; strcpy(addr.sun_path, path); len = offsetof(struct sockaddr_un, sun_path) + strlen(path); fd = socket(AF_UNIX, SOCK_STREAM, 0); if (fd == -1) - return (-1); + return -1; success = 0; while (!success) { if (connect(fd, (struct sockaddr *)&addr, len) == 0) @@ -223,7 +223,7 @@ int RAND_query_egd_bytes(const char *path, unsigned char *buf, int bytes) err: if (fd != -1) close(fd); - return (ret); + return ret; } int RAND_egd_bytes(const char *path, int bytes) @@ -236,12 +236,12 @@ int RAND_egd_bytes(const char *path, int bytes) if (RAND_status() == 1) ret = num; err: - return (ret); + return ret; } int RAND_egd(const char *path) { - return (RAND_egd_bytes(path, 255)); + return RAND_egd_bytes(path, 255); } # endif |