From a2371fa93365cc0bc0e46b9d65f3a47a074b1c30 Mon Sep 17 00:00:00 2001 From: Pauli Date: Thu, 6 Jul 2017 14:56:20 +1000 Subject: 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 (Merged from https://github.com/openssl/openssl/pull/3871) --- crypto/rand/rand_egd.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'crypto/rand/rand_egd.c') 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 @@ -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 -- cgit v1.2.3