Skip to content

Commit b138b41

Browse files
committed
Correctly cast the extension lengths - backport of (valkey-io#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: Ran Shidlansik <[email protected]>
1 parent ade6c7d commit b138b41

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/cluster.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2801,7 +2801,7 @@ int clusterProcessPacket(clusterLink *link) {
28012801
if (hdr->mflags[0] & CLUSTERMSG_FLAG0_EXT_DATA) {
28022802
clusterMsgPingExt *ext = getInitialPingExt(hdr, count);
28032803
while (extensions--) {
2804-
uint16_t extlen = getPingExtLength(ext);
2804+
uint32_t extlen = getPingExtLength(ext);
28052805
if (extlen % 8 != 0) {
28062806
serverLog(LL_WARNING, "Received a %s packet without proper padding (%d bytes)",
28072807
clusterGetMessageTypeString(type), (int) extlen);

0 commit comments

Comments
 (0)