From: Nick Mathewson Date: Thu, 5 Jun 2025 19:54:56 +0000 (-0400) Subject: sendme: Use a simpler and more correct init for sendme tags. X-Git-Tag: tor-0.4.9.3-alpha~35^2~5 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=714cdc422499aff78ed864e5fc4ec54d7b3374c6;p=thirdparty%2Ftor.git sendme: Use a simpler and more correct init for sendme tags. --- 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 {