diff options
author | Rich Salz <rsalz@openssl.org> | 2017-06-14 20:34:37 -0400 |
---|---|---|
committer | Pauli <paul.dale@oracle.com> | 2017-07-05 11:32:35 +1000 |
commit | 0904e79a6e6109240d5a552f2699408b26cf63ee (patch) | |
tree | df0b4928a751b05779164cf7dd84265407bea332 /apps/s_time.c | |
parent | ff281ee8369350d88e8b57af139614f5683e1e8c (diff) |
Undo commit d420ac2
[extended tests]
Original text:
Use BUF_strlcpy() instead of strcpy().
Use BUF_strlcat() instead of strcat().
Use BIO_snprintf() instead of sprintf().
In some cases, keep better track of buffer lengths.
This is part of a large change submitted by Markus Friedl <markus@openbsd.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/3701)
Diffstat (limited to 'apps/s_time.c')
-rw-r--r-- | apps/s_time.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/apps/s_time.c b/apps/s_time.c index bae2524af5..c4f4037363 100644 --- a/apps/s_time.c +++ b/apps/s_time.c @@ -173,7 +173,7 @@ int s_time_main(int argc, char **argv) break; case OPT_WWW: www_path = opt_arg(); - buf_size = strlen(www_path) + sizeof(fmt_http_get_cmd) - 2; /* 2 is for %s */ + buf_size = strlen(www_path) + sizeof(fmt_http_get_cmd); if (buf_size > sizeof(buf)) { BIO_printf(bio_err, "%s: -www option is too long\n", prog); goto end; @@ -230,8 +230,8 @@ int s_time_main(int argc, char **argv) goto end; if (www_path != NULL) { - buf_len = BIO_snprintf(buf, sizeof buf, - fmt_http_get_cmd, www_path); + sprintf(buf, fmt_http_get_cmd, www_path); + buf_len = strlen(buf); if (SSL_write(scon, buf, buf_len) <= 0) goto end; while ((i = SSL_read(scon, buf, sizeof(buf))) > 0) @@ -288,8 +288,8 @@ int s_time_main(int argc, char **argv) } if (www_path != NULL) { - buf_len = BIO_snprintf(buf, sizeof buf, - fmt_http_get_cmd, www_path); + sprintf(buf, fmt_http_get_cmd, www_path); + buf_len = strlen(buf); if (SSL_write(scon, buf, buf_len) <= 0) goto end; while (SSL_read(scon, buf, sizeof(buf)) > 0) @@ -319,8 +319,7 @@ int s_time_main(int argc, char **argv) goto end; if (www_path != NULL) { - BIO_snprintf(buf, sizeof buf, "GET %s HTTP/1.0\r\n\r\n", - www_path); + sprintf(buf, "GET %s HTTP/1.0\r\n\r\n", www_path); if (SSL_write(scon, buf, strlen(buf)) <= 0) goto end; while ((i = SSL_read(scon, buf, sizeof(buf))) > 0) |