From 714cdc422499aff78ed864e5fc4ec54d7b3374c6 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Thu, 5 Jun 2025 15:54:56 -0400 Subject: [PATCH] sendme: Use a simpler and more correct init for sendme tags. --- src/core/or/sendme.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/or/sendme.c b/src/core/or/sendme.c index a02f3a5376..77d9518048 100644 --- a/src/core/or/sendme.c +++ b/src/core/or/sendme.c @@ -347,9 +347,9 @@ record_cell_digest_on_circ(circuit_t *circ, // make sure we don't have heap overflow bugs. uint8_t *tag; if (tag_len == SHORT_TAG_LEN) { - tag = tor_malloc(sizeof(LONG_TAG_LEN)); + tag = tor_malloc_zero(LONG_TAG_LEN); memcpy(tag, sendme_tag, tag_len); - memset(tag+SHORT_TAG_LEN, 0, LONG_TAG_LEN - SHORT_TAG_LEN); + // (The final bytes were initialized to zero.) } else if (tag_len == LONG_TAG_LEN) { tag = tor_memdup(sendme_tag, LONG_TAG_LEN); } else { -- 2.47.2