X-Git-Url: http://git.scottworley.com/tl-append/blobdiff_plain/e81b7a5faa3c713ce4d4e0952d7640517f13ef69..90df84eb2e05926351cc7df661712c97779c9163:/tl-append-test.c diff --git a/tl-append-test.c b/tl-append-test.c index 4d51c38..08cf800 100644 --- a/tl-append-test.c +++ b/tl-append-test.c @@ -3,6 +3,7 @@ #include #include #include +#include #include #include #include @@ -89,6 +90,8 @@ static void verify_log_contents(ex_t exps[]) { die_err("Error opening log file"); for (size_t i = 0; !is_end(exps[i]); i++) { size_t len = TIMESTAMP_LEN + 1 + strlen(exps[i].message); + if (len > INT_MAX - 1) + die("message too long"); char *buf = (char *)malloc(len + 2); if (fgets(buf, len + 1, f) == NULL) die("Error reading log file");