From: Simon Ruderich Date: Mon, 29 Jul 2013 11:31:39 +0000 (+0200) Subject: Add two assert()s. X-Git-Url: https://ruderich.org/simon/gitweb/?p=tlsproxy%2Ftlsproxy.git;a=commitdiff_plain;h=780dee36f7c90cc505a64a8b4489dc1fbdeeb42a Add two assert()s. --- 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'",