Skip to content

fix: Prevent infinite loop#2875

Open
michael-grunder wants to merge 1 commit into
developfrom
fix/protocol-errors
Open

fix: Prevent infinite loop#2875
michael-grunder wants to merge 1 commit into
developfrom
fix/protocol-errors

Conversation

@michael-grunder

Copy link
Copy Markdown
Member

I've created an "evil" RESP server that intentionally returns malformed RESP replies and lies about MOVED/ASKING slots.

That surfaced a possible DOS bug where a malicous cluster could cause PhpRedis to spin forever.

This fixes that issue.

I've created an "evil" RESP server that intentionally returns malformed
RESP replies and lies about `MOVED`/`ASKING` slots.

That surfaced a possible DOS bug where a malicous cluster could cause
PhpRedis to spin forever.

This fixes that issue.
Comment thread cluster_library.c
Comment on lines +121 to +123
zend_throw_exception_ex(redis_cluster_exception_ce, 0,
"protocol error, invalid reply length");
return FAILURE;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
zend_throw_exception_ex(redis_cluster_exception_ce, 0,
"protocol error, invalid reply length");
return FAILURE;
goto failure;

Comment thread cluster_library.c
Comment on lines +129 to +131
zend_throw_exception_ex(redis_cluster_exception_ce, 0,
"protocol error, invalid reply length");
return FAILURE;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
zend_throw_exception_ex(redis_cluster_exception_ce, 0,
"protocol error, invalid reply length");
return FAILURE;
goto failure;

Comment thread cluster_library.c
}

c->reply_len = n;
return SUCCESS;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return SUCCESS;
return SUCCESS;
failure:
zend_throw_exception_ex(redis_cluster_exception_ce, 0,
"protocol error, invalid reply length");
return FAILURE;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants