Skip to content

Wrong usage of string length #9

Open
@laruence

Description

@laruence

Seems all string length uses int , which should introduce problems (segfault etc) after parameters parsing...

like:

/* {{{ proto array Redis::info() */
PHP_METHOD(Redis, info) {

    zval *object;
    RedisSock *redis_sock;
    char *cmd, *opt = NULL;
    int cmd_len, opt_len;

    if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(),
                "O|s", &object, redis_ce, &opt, &opt_len)
            == FAILURE)
    {
        RETURN_FALSE;
    }

opt_len should be size_t here.

and actually, it's better to use zend_string instead ("S")...

thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions