From ffb772b401a7e4d8ff166372a160eb0da562824c 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@ --- lib/libssl/s3_lib.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'lib/libssl/s3_lib.c') diff --git a/lib/libssl/s3_lib.c b/lib/libssl/s3_lib.c index 8a40b758a92..aa091f51c7c 100644 --- a/lib/libssl/s3_lib.c +++ b/lib/libssl/s3_lib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: s3_lib.c,v 1.71 2014/07/13 16:03:10 beck Exp $ */ +/* $OpenBSD: s3_lib.c,v 1.72 2014/08/07 19:46:31 miod Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -2333,7 +2333,7 @@ ssl3_new(SSL *s) SSL3_STATE *s3; if ((s3 = calloc(1, sizeof *s3)) == NULL) - goto err; + return 0; memset(s3->rrec.seq_num, 0, sizeof(s3->rrec.seq_num)); memset(s3->wrec.seq_num, 0, sizeof(s3->wrec.seq_num)); @@ -2341,8 +2341,6 @@ ssl3_new(SSL *s) s->method->ssl_clear(s); return (1); -err: - return (0); } void -- cgit v1.2.3-59-g8ed1b