Skip to content

Commit 30d7f08

Browse files
authored
Correctly cast the extension lengths (#2144)
Correctly use a 32 bit integer for accumulating the length of ping extensions. The current code may accidentally truncate the length of an extension that is greater than 64kb and fail the validation check. We don't currently emit any extensions that are this length, but if we were to do so in the future we might have issues with older nodes (without this fix) will silently drop packets from newer nodes. We should backport this to all versions. Signed-off-by: Madelyn Olson <[email protected]>
1 parent f5b92f5 commit 30d7f08

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/cluster_legacy.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3197,7 +3197,7 @@ int clusterIsValidPacket(clusterLink *link) {
31973197
if (hdr->mflags[0] & CLUSTERMSG_FLAG0_EXT_DATA) {
31983198
clusterMsgPingExt *ext = getInitialPingExt(hdr, count);
31993199
while (extensions--) {
3200-
uint16_t extlen = getPingExtLength(ext);
3200+
uint32_t extlen = getPingExtLength(ext);
32013201
if (extlen % 8 != 0) {
32023202
serverLog(LL_WARNING, "Received a %s packet without proper padding (%d bytes)",
32033203
clusterGetMessageTypeString(type), (int)extlen);

0 commit comments

Comments
 (0)