Use min_int() instead of MIN()+syshead.c compat definition.
PATCH 1/1 Use min_int() instead of MIN()+syshead.c compat definition.
Reverts commit 15ca5c297b556fbb, instead change ssl_openssl.c to use "min_int()", which is already defined in "integer.h"
--- src/openvpn/ssl_openssl.c | 2 +- src/openvpn/syshead.h | 7 ------- 2 files changed, 1 insertions(+), 8 deletions(-)
src/openvpn/ssl_openssl.c +1 -1
@@ -232,7 +232,7 @@ tls_ctx_restrict_ciphers(struct tls_root_ctx *ctx, const char *ciphers)// %.*s format specifier expects length of type int, so guarantee // that length is small enough and cast to int. msg (M_WARN ,"No valid translation found for TLS cipher '%.*s'" , - (int )MIN (current_cipher_len,256 ), current_cipher); + (int )min_int (current_cipher_len,256 ), current_cipher); }else {
src/openvpn/syshead.h +0 -7
@@ -399,13 +399,6 @@#endif /* -* do we have the MIN() macro? -*/ -#ifndef MIN -#define MIN (a,b) (((a)<(b))?(a):(b)) -#endif - -/* * Do we have the capability to report extended socket errors? */ #if defined(HAVE_LINUX_TYPES_H ) && defined(HAVE_LINUX_ERRQUEUE_H ) && defined(HAVE_SOCK_EXTENDED_ERR ) && defined(HAVE_MSGHDR ) && defined(HAVE_CMSGHDR ) && defined(CMSG_FIRSTHDR ) && defined(CMSG_NXTHDR ) && defined(IP_RECVERR ) && defined(MSG_ERRQUEUE ) && defined(SOL_IP ) && defined(HAVE_IOVEC )
Signature · 1 line
1.5.6.5
Quoted 3 lines · Gert Doering
Reverts commit
15ca5c297b556fbb, instead changessl_openssl.cto use "min_int()", which is already defined in "integer.h"
ACK
PATCH v2 1/1 Use constrain_int() instead of MIN()+syshead.c compat definition - v2.
In reply to Gert DoeringReverts commit 15ca5c297b556fbb, instead change ssl_openssl.c to use "constrain_int()", which already exists in "integer.h".
Using this instead of min_int() ensures that the result is always bounded to 0...256 even in the case of a potential MAX_INT overflow.
--- src/openvpn/ssl_openssl.c | 2 +- src/openvpn/syshead.h | 7 ------- 2 files changed, 1 insertions(+), 8 deletions(-)
src/openvpn/ssl_openssl.c +1 -1
@@ -232,7 +232,7 @@ tls_ctx_restrict_ciphers(struct tls_root_ctx *ctx, const char *ciphers)// %.*s format specifier expects length of type int, so guarantee // that length is small enough and cast to int. msg (M_WARN ,"No valid translation found for TLS cipher '%.*s'" , - (int )MIN (current_cipher_len,256 ), current_cipher); +constrain_int (current_cipher_len,0 ,256 ), current_cipher); }else {
src/openvpn/syshead.h +0 -7
@@ -399,13 +399,6 @@#endif /* -* do we have the MIN() macro? -*/ -#ifndef MIN -#define MIN (a,b) (((a)<(b))?(a):(b)) -#endif - -/* * Do we have the capability to report extended socket errors? */ #if defined(HAVE_LINUX_TYPES_H ) && defined(HAVE_LINUX_ERRQUEUE_H ) && defined(HAVE_SOCK_EXTENDED_ERR ) && defined(HAVE_MSGHDR ) && defined(HAVE_CMSGHDR ) && defined(CMSG_FIRSTHDR ) && defined(CMSG_NXTHDR ) && defined(IP_RECVERR ) && defined(MSG_ERRQUEUE ) && defined(SOL_IP ) && defined(HAVE_IOVEC )
Signature · 1 line
1.5.6.5
Re: [Openvpn-devel] [PATCH v2] Use constrain_int() instead of MIN()+syshead.c compat definition - v2.
Quoted 9 lines · Gert Doering
Reverts commit
15ca5c297b556fbb, instead changessl_openssl.cto use "constrain_int()", which already exists in "integer.h".Using this instead of
min_int()ensures that the result is always bounded to 0...256 even in the case of a potentialMAX_INToverflow.--- src/openvpn/ssl_openssl.c | 2 +- src/openvpn/syshead.h | 7 ------- 2 files changed, 1 insertions(+), 8 deletions(-)
I like this version better, as it ensures that the "field" length (of '%.*s') is enforced to be between 0 and 256.
So ACK from me.
Quoted 32 lines
src/openvpn/ssl_openssl.c +1
-1@@ -232,7 +232,7 @@ tls_ctx_restrict_ciphers(struct tls_root_ctx *ctx, const char *ciphers)// %.*s format specifier expects length of type int, so guarantee // that length is small enough and cast to int. msg (M_WARN ,"No valid translation found for TLS cipher '%.*s'" , - (int )MIN (current_cipher_len,256 ), current_cipher); +constrain_int (current_cipher_len,0 ,256 ), current_cipher); }else {src/openvpn/syshead.h +0
-7@@ -399,13 +399,6 @@#endif /* -* do we have the MIN() macro? -*/ -#ifndef MIN -#define MIN (a,b) (((a)<(b))?(a):(b)) -#endif - -/* * Do we have the capability to report extended socket errors? */ #if defined(HAVE_LINUX_TYPES_H ) && defined(HAVE_LINUX_ERRQUEUE_H ) && defined(HAVE_SOCK_EXTENDED_ERR ) && defined(HAVE_MSGHDR ) && defined(HAVE_CMSGHDR ) && defined(CMSG_FIRSTHDR ) && defined(CMSG_NXTHDR ) && defined(IP_RECVERR ) && defined(MSG_ERRQUEUE ) && defined(SOL_IP ) && defined(HAVE_IOVEC )
Signature · 3 lines
kind regards, David Sommerseth
[Openvpn-devel] [PATCH applied] Re: Use constrain_int() instead of MIN()+syshead.c compat definition - v2.
In reply to Gert DoeringYour patch has been applied to the master branch.
commit bd25aa66b76b82f335abbb7377c278a44da194ac
Author: Gert Doering Date: Mon May 6 09:55:41 2013 +0200
Use constrain_int() instead of MIN()+syshead.c compat definition - v2.
Signed-off-by: Gert Doering <[email protected]...>
Acked-by: David Sommerseth <[email protected]...>
Message-Id: [email protected]...
URL: http://article.gmane.org/gmane.network.openvpn.devel/7586
Signed-off-by: David Sommerseth <[email protected]...>Signature · 3 lines
kind regards, David Sommerseth