From 15e8f255e119bc9bcc3d331677007d5263431e63 Mon Sep 17 00:00:00 2001 From: miod <> Date: Thu, 7 Aug 2014 19:46:31 +0000 Subject: When you expect a function to return a particular value, don't put a comment saying that you expect it to return that value and compare it against zero because it is supposedly faster, for this leads to bugs (especially given the high rate of sloppy cut'n'paste within ssl3 and dtls1 routines in this library). Instead, compare for the exact value it ought to return upon success. ok deraadt@ --- src/lib/libssl/s23_srvr.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'src/lib/libssl/s23_srvr.c') diff --git a/src/lib/libssl/s23_srvr.c b/src/lib/libssl/s23_srvr.c index ee977130fb..5f8ffa8eaf 100644 --- a/src/lib/libssl/s23_srvr.c +++ b/src/lib/libssl/s23_srvr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: s23_srvr.c,v 1.32 2014/08/07 04:49:53 deraadt Exp $ */ +/* $OpenBSD: s23_srvr.c,v 1.33 2014/08/07 19:46:31 miod Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -448,11 +448,8 @@ ssl23_get_client_hello(SSL *s) } j = ssl23_read_bytes(s, n + 2); - /* We previously read 11 bytes, so if j > 0, we must have - * j == n+2 == s->packet_length. We have at least 11 valid - * packet bytes. */ - if (j <= 0) - return (j); + if (j != n + 2) + return -1; ssl3_finish_mac(s, s->packet + 2, s->packet_length - 2); if (s->msg_callback) -- cgit v1.2.3-55-g6feb