summaryrefslogtreecommitdiff
path: root/src/lib/libssl/s3_lib.c
diff options
context:
space:
mode:
authormiod <>2014-08-07 19:46:31 +0000
committermiod <>2014-08-07 19:46:31 +0000
commit15e8f255e119bc9bcc3d331677007d5263431e63 (patch)
treef63319cf5456a29e9fa85ebbd2f5e44de3fb4043 /src/lib/libssl/s3_lib.c
parent4bcdac8281676ec72b23bb5dbfa6716fc392dfc1 (diff)
downloadopenbsd-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/s3_lib.c')
-rw-r--r--src/lib/libssl/s3_lib.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/lib/libssl/s3_lib.c b/src/lib/libssl/s3_lib.c
index 8a40b758a9..aa091f51c7 100644
--- a/src/lib/libssl/s3_lib.c
+++ b/src/lib/libssl/s3_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: s3_lib.c,v 1.71 2014/07/13 16:03:10 beck Exp $ */ 1/* $OpenBSD: s3_lib.c,v 1.72 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 *
@@ -2333,7 +2333,7 @@ ssl3_new(SSL *s)
2333 SSL3_STATE *s3; 2333 SSL3_STATE *s3;
2334 2334
2335 if ((s3 = calloc(1, sizeof *s3)) == NULL) 2335 if ((s3 = calloc(1, sizeof *s3)) == NULL)
2336 goto err; 2336 return 0;
2337 memset(s3->rrec.seq_num, 0, sizeof(s3->rrec.seq_num)); 2337 memset(s3->rrec.seq_num, 0, sizeof(s3->rrec.seq_num));
2338 memset(s3->wrec.seq_num, 0, sizeof(s3->wrec.seq_num)); 2338 memset(s3->wrec.seq_num, 0, sizeof(s3->wrec.seq_num));
2339 2339
@@ -2341,8 +2341,6 @@ ssl3_new(SSL *s)
2341 2341
2342 s->method->ssl_clear(s); 2342 s->method->ssl_clear(s);
2343 return (1); 2343 return (1);
2344err:
2345 return (0);
2346} 2344}
2347 2345
2348void 2346void