tor

The Tor anonymity network
git clone https://git.dasho.dev/tor.git
Log | Files | Refs | README | LICENSE

commit 714cdc422499aff78ed864e5fc4ec54d7b3374c6
parent e7b40446560f2465f32438f338e4bfd826836dab
Author: Nick Mathewson <nickm@torproject.org>
Date:   Thu,  5 Jun 2025 15:54:56 -0400

sendme: Use a simpler and more correct init for sendme tags.

Diffstat:
Msrc/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 @@ -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 {