diff options
author | miod <> | 2014-08-07 19:46:31 +0000 |
---|---|---|
committer | miod <> | 2014-08-07 19:46:31 +0000 |
commit | 15e8f255e119bc9bcc3d331677007d5263431e63 (patch) | |
tree | f63319cf5456a29e9fa85ebbd2f5e44de3fb4043 /src/lib/libssl/s23_srvr.c | |
parent | 4bcdac8281676ec72b23bb5dbfa6716fc392dfc1 (diff) | |
download | openbsd-15e8f255e119bc9bcc3d331677007d5263431e63.tar.gz openbsd-15e8f255e119bc9bcc3d331677007d5263431e63.tar.bz2 openbsd-15e8f255e119bc9bcc3d331677007d5263431e63.zip |
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@
Diffstat (limited to 'src/lib/libssl/s23_srvr.c')
-rw-r--r-- | src/lib/libssl/s23_srvr.c | 9 |
1 files changed, 3 insertions, 6 deletions
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 @@ | |||
1 | /* $OpenBSD: s23_srvr.c,v 1.32 2014/08/07 04:49:53 deraadt Exp $ */ | 1 | /* $OpenBSD: s23_srvr.c,v 1.33 2014/08/07 19:46:31 miod Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -448,11 +448,8 @@ ssl23_get_client_hello(SSL *s) | |||
448 | } | 448 | } |
449 | 449 | ||
450 | j = ssl23_read_bytes(s, n + 2); | 450 | j = ssl23_read_bytes(s, n + 2); |
451 | /* We previously read 11 bytes, so if j > 0, we must have | 451 | if (j != n + 2) |
452 | * j == n+2 == s->packet_length. We have at least 11 valid | 452 | return -1; |
453 | * packet bytes. */ | ||
454 | if (j <= 0) | ||
455 | return (j); | ||
456 | 453 | ||
457 | ssl3_finish_mac(s, s->packet + 2, s->packet_length - 2); | 454 | ssl3_finish_mac(s, s->packet + 2, s->packet_length - 2); |
458 | if (s->msg_callback) | 455 | if (s->msg_callback) |