summaryrefslogtreecommitdiff
path: root/src/ot_stats.c
diff options
context:
space:
mode:
authorDirk Engling <erdgeist@erdgeist.org>2026-11-07 13:30:17 +0100
committerDirk Engling <erdgeist@erdgeist.org>2026-11-07 13:30:17 +0100
commitcfbe53da5d9ef8dad1bb3276c0b33ec2ab6e974b (patch)
treec553990fd398d9d20dab09df5ecdcba1da71264e /src/ot_stats.c
parentbbfd674e08c6b1fa4081f9c678fd220bead749d7 (diff)
Fix s24s stats to ensure no unallocated vector is dereferenced. Drive-by fix for the ip= scanner in the http parser
Diffstat (limited to 'src/ot_stats.c')
-rw-r--r--src/ot_stats.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/ot_stats.c b/src/ot_stats.c
index c50d4e3..9e2eabe 100644
--- a/src/ot_stats.c
+++ b/src/ot_stats.c
@@ -244,9 +244,13 @@ static void stats_slash24s_txt(char **reply, const char *reply_end, size_t amoun
244 ot_vector *torrents_list = mutex_bucket_lock(bucket); 244 ot_vector *torrents_list = mutex_bucket_lock(bucket);
245 for (i = 0; i < torrents_list->size; ++i) { 245 for (i = 0; i < torrents_list->size; ++i) {
246 ot_peerlist *peer_list = (((ot_torrent *)(torrents_list->data))[i]).peer_list4; 246 ot_peerlist *peer_list = (((ot_torrent *)(torrents_list->data))[i]).peer_list4;
247 ot_vector *bucket_list = &peer_list->peers; 247 ot_vector *bucket_list;
248 int num_buckets = 1; 248 int num_buckets = 1;
249 249
250 if (!peer_list)
251 continue;
252 bucket_list = &peer_list->peers;
253
250 if (OT_PEERLIST_HASBUCKETS(peer_list)) { 254 if (OT_PEERLIST_HASBUCKETS(peer_list)) {
251 num_buckets = bucket_list->size; 255 num_buckets = bucket_list->size;
252 bucket_list = (ot_vector *)bucket_list->data; 256 bucket_list = (ot_vector *)bucket_list->data;