summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorerdgeist <>2007-10-21 03:37:26 +0000
committererdgeist <>2007-10-21 03:37:26 +0000
commit2b715b89f12de4c2ea11b23af6d9fd51b54a956c (patch)
treef1355850037feb5cf15cd94498b1cda3b62098dd
parentddd85ec7e08d38fc46e0e96f01205d1ce4087aea (diff)
Debug code sometimes copied too much data
-rw-r--r--opentracker.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/opentracker.c b/opentracker.c
index f29e076..bfb5c53 100644
--- a/opentracker.c
+++ b/opentracker.c
@@ -226,11 +226,10 @@ static void httpresponse( const int64 s, char *data, size_t l ) {
226 size_t reply_size = 0, reply_off; 226 size_t reply_size = 0, reply_off;
227 227
228#ifdef _DEBUG_HTTPERROR 228#ifdef _DEBUG_HTTPERROR
229 memcpy( debug_request, data, sizeof( debug_request ) ); 229 if( l >= sizeof( debug_request ) )
230 if( l < sizeof( debug_request ) ) 230 l = sizeof( debug_request) - 1;
231 debug_request[ l ] = 0; 231 memcpy( debug_request, data, l );
232 else 232 debug_request[ l ] = 0;
233 debug_request[ sizeof( debug_request ) - 1 ] = 0;
234#endif 233#endif
235 234
236 /* This one implicitely tests strlen < 5, too -- remember, it is \n terminated */ 235 /* This one implicitely tests strlen < 5, too -- remember, it is \n terminated */