[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [libmicrohttpd] 03/08: test_large_put: use proper types for
From: |
gnunet |
Subject: |
[GNUnet-SVN] [libmicrohttpd] 03/08: test_large_put: use proper types for size variables |
Date: |
Sun, 22 Jan 2017 22:12:12 +0100 |
This is an automated email from the git hooks/post-receive script.
karlson2k pushed a commit to branch master
in repository libmicrohttpd.
commit a610b8cc9026e7ae30ab97557783df33188dc0c3
Author: Evgeny Grin (Karlson2k) <address@hidden>
AuthorDate: Thu Jan 12 11:09:22 2017 +0300
test_large_put: use proper types for size variables
---
src/testcurl/test_large_put.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/src/testcurl/test_large_put.c b/src/testcurl/test_large_put.c
index cd89c953..65489e7f 100644
--- a/src/testcurl/test_large_put.c
+++ b/src/testcurl/test_large_put.c
@@ -70,10 +70,13 @@ struct CBC
static size_t
putBuffer (void *stream, size_t size, size_t nmemb, void *ptr)
{
- unsigned int *pos = ptr;
- unsigned int wrt;
+ size_t *pos = (size_t *)ptr;
+ size_t wrt;
wrt = size * nmemb;
+ /* Check for overflow. */
+ if (wrt / size != nmemb)
+ return 0;
if (wrt > PUT_SIZE - (*pos))
wrt = PUT_SIZE - (*pos);
memcpy (stream, &put_buffer[*pos], wrt);
@@ -146,7 +149,7 @@ testPutInternalThread ()
struct MHD_Daemon *d;
CURL *c;
struct CBC cbc;
- unsigned int pos = 0;
+ size_t pos = 0;
int done_flag = 0;
CURLcode errornum;
char buf[2048];
@@ -204,7 +207,7 @@ testPutThreadPerConn ()
struct MHD_Daemon *d;
CURL *c;
struct CBC cbc;
- unsigned int pos = 0;
+ size_t pos = 0;
int done_flag = 0;
CURLcode errornum;
char buf[2048];
@@ -265,7 +268,7 @@ testPutThreadPool ()
struct MHD_Daemon *d;
CURL *c;
struct CBC cbc;
- unsigned int pos = 0;
+ size_t pos = 0;
int done_flag = 0;
CURLcode errornum;
char buf[2048];
@@ -342,7 +345,7 @@ testPutExternal ()
struct CURLMsg *msg;
time_t start;
struct timeval tv;
- unsigned int pos = 0;
+ size_t pos = 0;
int done_flag = 0;
char buf[2048];
--
To stop receiving notification emails like this one, please contact
address@hidden
- [GNUnet-SVN] [libmicrohttpd] branch master updated (44eec406 -> c623d35d), gnunet, 2017/01/22
- [GNUnet-SVN] [libmicrohttpd] 05/08: test_large_put: initialise test buffer with varied data to detect more errors., gnunet, 2017/01/22
- [GNUnet-SVN] [libmicrohttpd] 07/08: test_large_put: added test with incremental read and limited buffer, gnunet, 2017/01/22
- [GNUnet-SVN] [libmicrohttpd] 01/08: test_large_put: updated to use correct check for "11" in name and return '99' in case of system failures., gnunet, 2017/01/22
- [GNUnet-SVN] [libmicrohttpd] 03/08: test_large_put: use proper types for size variables,
gnunet <=
- [GNUnet-SVN] [libmicrohttpd] 02/08: test_large_put: renamed functions for readability, gnunet, 2017/01/22
- [GNUnet-SVN] [libmicrohttpd] 04/08: test_large_put: support incremental reading of incoming data, gnunet, 2017/01/22
- [GNUnet-SVN] [libmicrohttpd] 08/08: test_large_put: added poll() and epoll testing., gnunet, 2017/01/22
- [GNUnet-SVN] [libmicrohttpd] 06/08: test_large_put: added verbosity, gnunet, 2017/01/22