Here is the patch

-- 
"And if cynics ridicule freedom, ridicule community...if ``hard nosed
realists'' say that profit is the only ideal...just ignore them, and use
copyleft all the same. "        -- (RMS)
Saludos /\/\ /\ >< `/
--- mod-bt-0.0.19+p4.2340.orig/src/libbttracker/Net-BitTorrent-LibBT-Tracker/Tracker.xs
+++ mod-bt-0.0.19+p4.2340/src/libbttracker/Net-BitTorrent-LibBT-Tracker/Tracker.xs
@@ -242,7 +242,7 @@
 	if(stylesheet)
 	{
 	 strncpy(c->stylesheet, stylesheet, sizeof(c->stylesheet) - 1);
-	 c->stylesheet[sizeof(c->stylesheet)] = 0;
+	 c->stylesheet[sizeof(c->stylesheet) - 1] = 0;
 	}
 	
 	OUTPUT:
@@ -259,7 +259,7 @@
 	if(detail_url)
 	{
 	 strncpy(c->detail_url, detail_url, sizeof(c->detail_url) - 1);
-	 c->detail_url[sizeof(c->detail_url)] = 0;
+	 c->detail_url[sizeof(c->detail_url) - 1] = 0;
 	}
 	
 	OUTPUT:
@@ -276,7 +276,7 @@
 	if(root_include)
 	{
 	 strncpy(c->root_include, root_include, sizeof(c->root_include) - 1);
-	 c->root_include[sizeof(c->root_include)] = 0;
+	 c->root_include[sizeof(c->root_include) - 1] = 0;
 	}
 	
 	OUTPUT:
@@ -772,7 +772,7 @@
 	if(newname)
 	{
 	 strncpy(h->hash->filename, newname, sizeof(h->hash->filename) - 1);
-	 h->hash->filename[sizeof(h->hash->filename)] = 0;
+	 h->hash->filename[sizeof(h->hash->filename) - 1] = 0;
 	}
 	
 	OUTPUT:
--- mod-bt-0.0.19+p4.2340.orig/src/libbttracker/txn/btt_txn_register_hash.c
+++ mod-bt-0.0.19+p4.2340/src/libbttracker/txn/btt_txn_register_hash.c
@@ -70,7 +70,7 @@
  
     if(filename && *filename) {
         BT_STRCPY(hash->filename, filename);
-        hash->filename[BT_FILE_LEN] = 0;
+        hash->filename[BT_FILE_LEN - 1] = 0;
     }
  
     if(filesize)
--- mod-bt-0.0.19+p4.2340.orig/src/libbttracker/cxn/btt_cxn_announce.c
+++ mod-bt-0.0.19+p4.2340/src/libbttracker/cxn/btt_cxn_announce.c
@@ -147,7 +147,7 @@
  if(user_agent && *user_agent)
   strncpy(peer->ua, user_agent, sizeof(peer->ua) - 1);
  
- peer->ua[sizeof(peer->ua)] = 0;
+ peer->ua[sizeof(peer->ua) - 1] = 0;
  peer->flags = (peer->flags & BTT_PEER_KEEP_FLAGS) | in_peer.flags;
  strncpy(peer->event, in_peer.event, sizeof(peer->event) - 1);
  peer->event[sizeof(peer->event)-1] = 0;

Reply via email to