diff options
| author | cheloha <> | 2018-08-28 02:14:22 +0000 |
|---|---|---|
| committer | cheloha <> | 2018-08-28 02:14:22 +0000 |
| commit | 47c7a81989b6ae45dcc149174f78c3487c2b3c3f (patch) | |
| tree | d54377b4762f0e128302732ac42fa44a917d1d93 | |
| parent | 0aef55c50c0eefb9407b608ea12a99e003985f37 (diff) | |
| download | openbsd-47c7a81989b6ae45dcc149174f78c3487c2b3c3f.tar.gz openbsd-47c7a81989b6ae45dcc149174f78c3487c2b3c3f.tar.bz2 openbsd-47c7a81989b6ae45dcc149174f78c3487c2b3c3f.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 '')
| -rw-r--r-- | src/usr.bin/openssl/s_time.c | 7 |
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 | } |
