From: Dan Fandrich Date: Sat, 13 May 2017 20:57:49 +0000 (+0200) Subject: lib510: don't write past the end of the buffer if it's too small X-Git-Tag: curl-7_54_1~117 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b1fa80b84facb94a667a6bfaa99476a161285b0d;p=thirdparty%2Fcurl.git lib510: don't write past the end of the buffer if it's too small --- diff --git a/tests/libtest/lib510.c b/tests/libtest/lib510.c index 68588cfe6c..4c290f1ef7 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;