Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/boringssl.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tool
diff options
context:
space:
mode:
authorDavid Benjamin <davidben@chromium.org>2015-08-28 22:43:26 +0300
committerAdam Langley <agl@google.com>2015-08-29 01:47:26 +0300
commited50cee007ce5c31416de921865970298b71e715 (patch)
tree98e6b8a46519edc49e26a3efbe9cf1bd208d0a27 /tool
parentffadb3969f7e739ad3f8ccde67508f065d154fd1 (diff)
Check fread's return value in tool/server.cc.
Some compilers complain and it's worth checking. Maybe the file changed in size between ftell and fread. Change-Id: I7898b8517556ec6899bd6e8866ba3d1cd7efd5f4 Reviewed-on: https://boringssl-review.googlesource.com/5763 Reviewed-by: Adam Langley <agl@google.com>
Diffstat (limited to 'tool')
-rw-r--r--tool/server.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/tool/server.cc b/tool/server.cc
index 69994bcc..abc71cfd 100644
--- a/tool/server.cc
+++ b/tool/server.cc
@@ -46,6 +46,7 @@ static const struct argument kArguments[] = {
static bool LoadOCSPResponse(SSL_CTX *ctx, const char *filename) {
void *data = NULL;
bool ret = false;
+ size_t bytes_read;
long length;
FILE *f = fopen(filename, "rb");
@@ -66,9 +67,10 @@ static bool LoadOCSPResponse(SSL_CTX *ctx, const char *filename) {
}
rewind(f);
- fread(data, 1, length, f);
+ bytes_read = fread(data, 1, length, f);
if (ferror(f) != 0 ||
- !SSL_CTX_set_ocsp_response(ctx, (uint8_t*)data, length)) {
+ bytes_read != (size_t)length ||
+ !SSL_CTX_set_ocsp_response(ctx, (uint8_t*)data, bytes_read)) {
goto out;
}