summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--opentracker.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/opentracker.c b/opentracker.c
index 0034ec5..d2df803 100644
--- a/opentracker.c
+++ b/opentracker.c
@@ -130,6 +130,7 @@ e400:
130 { 130 {
131 // info_hash, left, port, numwant, compact 131 // info_hash, left, port, numwant, compact
132 struct ot_peer peer; 132 struct ot_peer peer;
133 ot_hash hash;
133 byte_copy( peer.ip, h->ip, 4); 134 byte_copy( peer.ip, h->ip, 4);
134 peer.port = 6881; 135 peer.port = 6881;
135 136
@@ -137,10 +138,14 @@ e400:
137 while( *c!=' ' ) { 138 while( *c!=' ' ) {
138 if(!byte_diff(c,10,"info_hash=")) 139 if(!byte_diff(c,10,"info_hash="))
139 { 140 {
141 size_t destlen = 20;
140 // String is expected to be URL encoded, so expect 142 // String is expected to be URL encoded, so expect
141 // (%[0-9A-F][0-9A-F]){20} 143 // (%[0-9A-F][0-9A-F]){20}
142 int s = scan_urlencoded( 144
143 145 int s = scan_urlencoded( c+10, hash, &destlen);
146 if( c[s+10] != '&' )
147 goto e_parse;
148
144 } 149 }
145 else if(!byte_diff(c,8,"numwant=")) 150 else if(!byte_diff(c,8,"numwant="))
146 { 151 {