From b1fa80b84facb94a667a6bfaa99476a161285b0d Mon Sep 17 00:00:00 2001 From: Dan Fandrich Date: Sat, 13 May 2017 22:57:49 +0200 Subject: lib510: don't write past the end of the buffer if it's too small --- tests/libtest/lib510.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/libtest/lib510.c b/tests/libtest/lib510.c index 68588cfe6..4c290f1ef 100644 --- a/tests/libtest/lib510.c +++ b/tests/libtest/lib510.c @@ -48,6 +48,10 @@ static size_t read_callback(void *ptr, size_t size, size_t nmemb, void *userp) if(data) { size_t len = strlen(data); + if(size*nmemb < len) { + fprintf(stderr, "read buffer is too small to run test\n"); + return 0; + } memcpy(ptr, data, len); pooh->counter++; /* advance pointer */ return len; -- cgit v1.2.1