summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--opentracker.c2
-rw-r--r--ot_http.c4
-rw-r--r--scan_urlencoded_query.c2
-rw-r--r--trackerlogic.c5
4 files changed, 6 insertions, 7 deletions
diff --git a/opentracker.c b/opentracker.c
index fd1698a..6cca576 100644
--- a/opentracker.c
+++ b/opentracker.c
@@ -201,7 +201,7 @@ static void server_mainloop( ) {
201 ws.inbuf = malloc( G_INBUF_SIZE ); 201 ws.inbuf = malloc( G_INBUF_SIZE );
202 ws.outbuf = malloc( G_OUTBUF_SIZE ); 202 ws.outbuf = malloc( G_OUTBUF_SIZE );
203#ifdef _DEBUG_HTTPERROR 203#ifdef _DEBUG_HTTPERROR
204 ws.debugbuf= malloc( G_INBUF_SIZE ); 204 ws.debugbuf= malloc( G_DEBUGBUF_SIZE );
205#endif 205#endif
206 if( !ws.inbuf || !ws.outbuf ) 206 if( !ws.inbuf || !ws.outbuf )
207 panic( "Initializing worker failed" ); 207 panic( "Initializing worker failed" );
diff --git a/ot_http.c b/ot_http.c
index 3ccdb84..bc3aef0 100644
--- a/ot_http.c
+++ b/ot_http.c
@@ -247,7 +247,7 @@ static ssize_t http_handle_fullscrape( const int64 sock, struct ot_workstruct *w
247 stats_issue_event( EVENT_FULLSCRAPE_REQUEST, 0, (uintptr_t)cookie->ip ); 247 stats_issue_event( EVENT_FULLSCRAPE_REQUEST, 0, (uintptr_t)cookie->ip );
248 248
249#ifdef _DEBUG_HTTPERROR 249#ifdef _DEBUG_HTTPERROR
250write( 2, ws->debugbuf, G_DEBUGBUF_SIZE ); 250 fprintf( stderr, "%s", ws->debugbuf );
251#endif 251#endif
252 252
253 /* Pass this task to the worker thread */ 253 /* Pass this task to the worker thread */
@@ -299,7 +299,7 @@ static ssize_t http_handle_scrape( const int64 sock, struct ot_workstruct *ws, c
299 return ws->reply_size; 299 return ws->reply_size;
300} 300}
301 301
302static ot_keywords keywords_announce[] = { { "port", 1 }, { "left", 2 }, { "event", 3 }, { "numwant", 4 }, { "compact", 5 }, { "info_hash", 6 }, 302static ot_keywords keywords_announce[] = { { "port", 1 }, { "left", 2 }, { "event", 3 }, { "numwant", 4 }, { "compact", 5 }, { "compact6", 5 }, { "info_hash", 6 },
303#ifdef WANT_IP_FROM_QUERY_STRING 303#ifdef WANT_IP_FROM_QUERY_STRING
304{ "ip", 7 }, 304{ "ip", 7 },
305#endif 305#endif
diff --git a/scan_urlencoded_query.c b/scan_urlencoded_query.c
index d8786a1..721dd44 100644
--- a/scan_urlencoded_query.c
+++ b/scan_urlencoded_query.c
@@ -75,7 +75,7 @@ int scan_find_keywords( const ot_keywords * keywords, char **string, SCAN_SEARCH
75 if( match_length == 0 ) return -3; 75 if( match_length == 0 ) return -3;
76 76
77 while( keywords->key ) { 77 while( keywords->key ) {
78 if( !memcmp( keywords->key, deststring, match_length ) ) 78 if( !memcmp( keywords->key, deststring, match_length ) && !keywords->key[match_length] )
79 return keywords->value; 79 return keywords->value;
80 keywords++; 80 keywords++;
81 } 81 }
diff --git a/trackerlogic.c b/trackerlogic.c
index d07851e..3ca266a 100644
--- a/trackerlogic.c
+++ b/trackerlogic.c
@@ -129,7 +129,7 @@ size_t add_peer_to_torrent_and_return_peers( ot_hash hash, ot_peer *peer, PROTO_
129 OT_PEERFLAG( peer ) |= PEER_FLAG_COMPLETED; 129 OT_PEERFLAG( peer ) |= PEER_FLAG_COMPLETED;
130 } 130 }
131 131
132 *peer_dest = *peer; 132 memcpy( peer_dest, peer, sizeof(ot_peer) );
133#ifdef WANT_SYNC 133#ifdef WANT_SYNC
134 if( proto == FLAG_MCA ) { 134 if( proto == FLAG_MCA ) {
135 mutex_bucket_unlock_by_hash( hash, delta_torrentcount ); 135 mutex_bucket_unlock_by_hash( hash, delta_torrentcount );
@@ -156,8 +156,7 @@ static size_t return_peers_all( ot_peerlist *peer_list, char *reply ) {
156 ot_peer * peers = (ot_peer*)bucket_list[bucket].data; 156 ot_peer * peers = (ot_peer*)bucket_list[bucket].data;
157 size_t peer_count = bucket_list[bucket].size; 157 size_t peer_count = bucket_list[bucket].size;
158 while( peer_count-- ) { 158 while( peer_count-- ) {
159 memcpy(r,peers,OT_PEER_COMPARE_SIZE); 159 memcpy(r,peers++,OT_PEER_COMPARE_SIZE);
160 peers+=sizeof(ot_peer);
161 r+=OT_PEER_COMPARE_SIZE; 160 r+=OT_PEER_COMPARE_SIZE;
162 } 161 }
163 } 162 }