Attention is currently required from: plaisthos.
Hello plaisthos,
I'd like you to do a code review.
Please visit
http://gerrit.openvpn.net/c/openvpn/+/1523?usp=email
to review the following change.
Change subject: socket: Avoid sign-compare issue by comparing before assignment
......................................................................
socket: Avoid sign-compare issue by comparing before assignment
The assignment implicitly converts the values, but
we can just do the comparison before the assignment.
Change-Id: Idf5ce8f82e7727505cce67560e0b7423b8e41a40
Signed-off-by: Frank Lichtenheld <[email protected]>
---
M src/openvpn/socket.c
1 file changed, 2 insertions(+), 12 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/23/1523/1
diff --git a/src/openvpn/socket.c b/src/openvpn/socket.c
index 698e724..13322f5 100644
--- a/src/openvpn/socket.c
+++ b/src/openvpn/socket.c
@@ -2523,11 +2523,6 @@
return WSAGetLastError();
}
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wsign-compare"
-#endif
-
int
socket_recv_queue(struct link_socket *sock, int maxsize)
{
@@ -2552,11 +2547,10 @@
/* Win32 docs say it's okay to allocate the wsabuf on the stack */
wsabuf[0].buf = BSTR(&sock->reads.buf);
+ /* make sure maxsize is sane */
+ ASSERT(maxsize <= BLEN(&sock->reads.buf));
wsabuf[0].len = maxsize ? maxsize : BLEN(&sock->reads.buf);
- /* check for buffer overflow */
- ASSERT(wsabuf[0].len <= BLEN(&sock->reads.buf));
-
/* the overlapped read will signal this event on I/O completion */
ASSERT(ResetEvent(sock->reads.overlapped.hEvent));
sock->reads.flags = 0;
@@ -2629,10 +2623,6 @@
return sock->reads.iostate;
}
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic pop
-#endif
-
int
socket_send_queue(struct link_socket *sock, struct buffer *buf, const struct
link_socket_actual *to)
{
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1523?usp=email
To unsubscribe, or for help writing mail filters, visit
http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Idf5ce8f82e7727505cce67560e0b7423b8e41a40
Gerrit-Change-Number: 1523
Gerrit-PatchSet: 1
Gerrit-Owner: flichtenheld <[email protected]>
Gerrit-Reviewer: plaisthos <[email protected]>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]>
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel