Skip to content

php_memc_*_impl wrongly return MEMCACHED_BAD_KEY_PROVIDED when whitespace in key in binary mode #188

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
dfuhry opened this issue Sep 27, 2015 · 1 comment

Comments

@dfuhry
Copy link

dfuhry commented Sep 27, 2015

The php_memcached.c php_memc_*_impl() functions perform the below check, which is correct in non-binary mode, but incorrect in binary mode:
if (key_len == 0 || strchr(key, ' ')) {
i_obj->rescode = MEMCACHED_BAD_KEY_PROVIDED;
RETURN_FALSE;
}
In binary mode, spaces are allowed in keys, so the strchr call should be skipped.

Also to be completely correct for non-binary mode, I guess it should check for any whitespace character (tab, etc.; not just space). I do not care about this last point for my current purposes though.

@mkoppanen
Copy link
Member

Fixed in php7 branch

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

No branches or pull requests

2 participants