aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDan Fandrich <dan@coneharvesters.com>2017-05-13 22:57:49 +0200
committerDan Fandrich <dan@coneharvesters.com>2017-05-13 23:13:09 +0200
commitb1fa80b84facb94a667a6bfaa99476a161285b0d (patch)
tree3354a58986a60ae0afe93099019004c366ebca9e /tests
parent646dc1c42a57298a487fceac4e62cae2b420e78f (diff)
lib510: don't write past the end of the buffer if it's too small
Diffstat (limited to 'tests')
-rw-r--r--tests/libtest/lib510.c4
1 files changed, 4 insertions, 0 deletions
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;