From 780dee36f7c90cc505a64a8b4489dc1fbdeeb42a Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Mon, 29 Jul 2013 13:31:39 +0200 Subject: [PATCH] Add two assert()s. --- src/connection.c | 2 ++ src/verify.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/connection.c b/src/connection.c index b7b9d68..2875b76 100644 --- a/src/connection.c +++ b/src/connection.c @@ -23,6 +23,7 @@ #include #include +#include #include #include #include @@ -528,6 +529,7 @@ static int read_http_request(FILE *client_fd, char *request, size_t length) { char buffer[MAX_REQUEST_LINE]; int found_proxy_authorization; + assert(length <= INT_MAX); if (fgets(request, (int)length, client_fd) == NULL) { if (ferror(client_fd)) { LOG_PERROR(WARNING, "read_http_request(): fgets()"); diff --git a/src/verify.c b/src/verify.c index d400276..f674236 100644 --- a/src/verify.c +++ b/src/verify.c @@ -20,6 +20,7 @@ #include "tlsproxy.h" #include "verify.h" +#include #include #include @@ -180,6 +181,7 @@ static int get_certificate_path(const char *format, int result; /* Hostname too long. */ + assert(size > strlen(format)); if (size - strlen(format) <= strlen(hostname)) { LOG(WARNING, "get_certificate_path(): hostname too long: '%s'", -- 2.45.2