summaryrefslogtreecommitdiff
path: root/src/usr.bin
diff options
context:
space:
mode:
authorcheloha <>2018-08-28 02:14:22 +0000
committercheloha <>2018-08-28 02:14:22 +0000
commit3db08ad9da0d956ac3e0fbe2ee2be51a1bed9218 (patch)
treed54377b4762f0e128302732ac42fa44a917d1d93 /src/usr.bin
parente0c2b5deb5b235daf11469d4f81c8279c0601088 (diff)
downloadopenbsd-3db08ad9da0d956ac3e0fbe2ee2be51a1bed9218.tar.gz
openbsd-3db08ad9da0d956ac3e0fbe2ee2be51a1bed9218.tar.bz2
openbsd-3db08ad9da0d956ac3e0fbe2ee2be51a1bed9218.zip
Check for SSL_write(3) error.
jsing@ notes that this is not a complete solution, as we don't account for retries or partial writes, but that this is a step in a right direction. May want to revisit this later to provide a complete solution. ok jsing@
Diffstat (limited to 'src/usr.bin')
-rw-r--r--src/usr.bin/openssl/s_time.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/usr.bin/openssl/s_time.c b/src/usr.bin/openssl/s_time.c
index 906d36228f..91a6855d88 100644
--- a/src/usr.bin/openssl/s_time.c
+++ b/src/usr.bin/openssl/s_time.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: s_time.c,v 1.29 2018/08/22 20:36:24 cheloha Exp $ */ 1/* $OpenBSD: s_time.c,v 1.30 2018/08/28 02:14:22 cheloha 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 *
@@ -376,11 +376,12 @@ run_test(SSL *scon)
376 if (s_time_config.www_path != NULL) { 376 if (s_time_config.www_path != NULL) {
377 retval = snprintf(buf, sizeof buf, 377 retval = snprintf(buf, sizeof buf,
378 "GET %s HTTP/1.0\r\n\r\n", s_time_config.www_path); 378 "GET %s HTTP/1.0\r\n\r\n", s_time_config.www_path);
379 if ((size_t)retval >= sizeof buf) { 379 if (retval == -1 || retval >= sizeof buf) {
380 fprintf(stderr, "URL too long\n"); 380 fprintf(stderr, "URL too long\n");
381 return 0; 381 return 0;
382 } 382 }
383 SSL_write(scon, buf, strlen(buf)); 383 if (SSL_write(scon, buf, retval) != retval)
384 return 0;
384 while ((i = SSL_read(scon, buf, sizeof(buf))) > 0) 385 while ((i = SSL_read(scon, buf, sizeof(buf))) > 0)
385 bytes_read += i; 386 bytes_read += i;
386 } 387 }