Commit b1fa80b8 authored by Dan Fandrich's avatar Dan Fandrich
Browse files

lib510: don't write past the end of the buffer if it's too small

parent 646dc1c4
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -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;