summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lib/libcrypto/bio/bio_lib.c28
1 files changed, 21 insertions, 7 deletions
diff --git a/src/lib/libcrypto/bio/bio_lib.c b/src/lib/libcrypto/bio/bio_lib.c
index 92c0d5eb1c..b33ebe167b 100644
--- a/src/lib/libcrypto/bio/bio_lib.c
+++ b/src/lib/libcrypto/bio/bio_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: bio_lib.c,v 1.37 2022/11/28 07:50:00 tb Exp $ */ 1/* $OpenBSD: bio_lib.c,v 1.38 2022/11/30 01:56:18 jsing 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 *
@@ -322,12 +322,19 @@ BIO_read(BIO *b, void *out, int outl)
322 size_t readbytes = 0; 322 size_t readbytes = 0;
323 int ret; 323 int ret;
324 324
325 if (b == NULL) 325 if (b == NULL) {
326 return (0); 326 BIOerror(ERR_R_PASSED_NULL_PARAMETER);
327 return (-1);
328 }
327 329
328 if (out == NULL || outl <= 0) 330 if (outl <= 0)
329 return (0); 331 return (0);
330 332
333 if (out == NULL) {
334 BIOerror(ERR_R_PASSED_NULL_PARAMETER);
335 return (-1);
336 }
337
331 if (b->method == NULL || b->method->bread == NULL) { 338 if (b->method == NULL || b->method->bread == NULL) {
332 BIOerror(BIO_R_UNSUPPORTED_METHOD); 339 BIOerror(BIO_R_UNSUPPORTED_METHOD);
333 return (-2); 340 return (-2);
@@ -372,12 +379,19 @@ BIO_write(BIO *b, const void *in, int inl)
372 size_t writebytes = 0; 379 size_t writebytes = 0;
373 int ret; 380 int ret;
374 381
375 if (b == NULL) 382 if (b == NULL) {
376 return (0); 383 BIOerror(ERR_R_PASSED_NULL_PARAMETER);
384 return (-1);
385 }
377 386
378 if (in == NULL || inl <= 0) 387 if (inl <= 0)
379 return (0); 388 return (0);
380 389
390 if (in == NULL) {
391 BIOerror(ERR_R_PASSED_NULL_PARAMETER);
392 return (-1);
393 }
394
381 if (b->method == NULL || b->method->bwrite == NULL) { 395 if (b->method == NULL || b->method->bwrite == NULL) {
382 BIOerror(BIO_R_UNSUPPORTED_METHOD); 396 BIOerror(BIO_R_UNSUPPORTED_METHOD);
383 return (-2); 397 return (-2);