diff options
author | cheloha <cheloha@cvs.openbsd.org> | 2018-08-28 02:14:23 +0000 |
---|---|---|
committer | cheloha <cheloha@cvs.openbsd.org> | 2018-08-28 02:14:23 +0000 |
commit | 33817e4cb3488d481335a84efa267702de077466 (patch) | |
tree | 65780414e776cf7c07dcc5328045701f939cf4da /usr.bin | |
parent | 381b2f8acc42c4b05bf099a17426b8d8d7118a6c (diff) |
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 'usr.bin')
-rw-r--r-- | usr.bin/openssl/s_time.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/usr.bin/openssl/s_time.c b/usr.bin/openssl/s_time.c index 906d36228fe..91a6855d886 100644 --- a/usr.bin/openssl/s_time.c +++ b/usr.bin/openssl/s_time.c @@ -1,4 +1,4 @@ -/* $OpenBSD: s_time.c,v 1.29 2018/08/22 20:36:24 cheloha Exp $ */ +/* $OpenBSD: s_time.c,v 1.30 2018/08/28 02:14:22 cheloha Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -376,11 +376,12 @@ run_test(SSL *scon) if (s_time_config.www_path != NULL) { retval = snprintf(buf, sizeof buf, "GET %s HTTP/1.0\r\n\r\n", s_time_config.www_path); - if ((size_t)retval >= sizeof buf) { + if (retval == -1 || retval >= sizeof buf) { fprintf(stderr, "URL too long\n"); return 0; } - SSL_write(scon, buf, strlen(buf)); + if (SSL_write(scon, buf, retval) != retval) + return 0; while ((i = SSL_read(scon, buf, sizeof(buf))) > 0) bytes_read += i; } |