From ef5cd63d9f6a9f4b7934ca3bf799302605a648fa Mon Sep 17 00:00:00 2001 From: evgeny Date: Thu, 1 Oct 2026 16:40:53 +0300 Subject: [PATCH] Set injected control packet lengths so replay and quota checks execute --- tests/test_dm_media.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/test_dm_media.c b/tests/test_dm_media.c index 1396619e..aad3bdb6 100644 --- a/tests/test_dm_media.c +++ b/tests/test_dm_media.c @@ -158,6 +158,7 @@ static void control(struct media_test* t, int dst, uint64_t source, uint8_t cmd, struct ETCP_CONN* conn = instance_find_conn(inst, t->ids[dst == S ? M : S]); struct ll_entry* e = ll_alloc_lldgram((uint16_t)(ROUTER_SVC_PAYLOAD_OFF + 1 + len)); if (!conn || !e) { if (e) { queue_dgram_free(e); queue_entry_free(e); } failure(t, "control fixture unavailable"); return; } + e->len = (uint16_t)(ROUTER_SVC_PAYLOAD_OFF + 1 + len); memset(e->dgram, 0, e->len); e->dgram[0] = ETCP_RT_ID_DM_MEDIA; memcpy(e->dgram + ROUTER_SVC_SRC_OFF, &source, 8); memcpy(e->dgram + ROUTER_SVC_DST_OFF, &inst->node_id, 8); @@ -195,7 +196,8 @@ static int protocol_checks(struct media_test* t) { uint64_t size = 2 * 1024 * 1024; memcpy(metadata + 16, &size, 8); if (sc_ed25519_sign(a->my_ed25519_privkey, request + 8, t->body_len - DM_MSG_SIG_SIZE, - request + 8 + t->body_len - DM_MSG_SIG_SIZE) || chat_setting_set(m, "dm_media_storage_mb", "1")) return -1; + request + 8 + t->body_len - DM_MSG_SIG_SIZE) || + dm_verify_message(m, t->ids[B], request + 8, t->body_len) || chat_setting_set(m, "dm_media_storage_mb", "1")) return -1; control(t, M, t->ids[S], DM_MEDIA_STORE, request, 8 + t->body_len); if (value(m, "SELECT count(*) FROM dm_custody") != 0 || chat_setting_set(m, "dm_media_storage_mb", "1024")) return -1; char path[768]; snprintf(path, sizeof(path), "%s/cancelled.download", t->dir);