Skip to content
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

[BUG] [CRASH] Segmentation Fault in zim_Phalcon_Acl_Adapter_Memory_dropResourceAccess #1376

Closed
ghost opened this issue Oct 13, 2013 · 3 comments

Comments

@ghost
Copy link

ghost commented Oct 13, 2013

Sample code:

<?php
$a = new \Phalcon\Acl\Adapter\Memory();
$a->dropResourceAccess('resource', 'accesslist');
?>

Happens because:

PHP_METHOD(Phalcon_Acl_Adapter_Memory, dropResourceAccess){

    zval *resource_name, *access_list, *access_name = NULL;
    zval *access_key = NULL;
    PHALCON_MM_GROW();

    phalcon_fetch_params(1, 2, 0, &resource_name, &access_list);

    if (Z_TYPE_P(access_list) == IS_ARRAY) { 
        /* ... */
    } else {
        PHALCON_INIT_NVAR(access_key);
        /* access_name == NULL, segfault :-( */
        PHALCON_CONCAT_VSV(access_key, resource_name, "!", access_name);
        phalcon_unset_property_array(this_ptr, SL("_accessList"), access_key TSRMLS_CC);
    }

    /* ... */
}
@ghost
Copy link
Author

ghost commented Oct 13, 2013

@phalcon Need your help here, I am not sure what access_key should be in this case…

@ghost
Copy link
Author

ghost commented Oct 13, 2013

I have replaced it with

PHALCON_CONCAT_VSV(access_key, resource_name, "!", access_list);

so far, not sure if it is OK.

@ghost
Copy link
Author

ghost commented Oct 17, 2013

Fixed in #1375

@ghost ghost closed this as completed Oct 17, 2013
This issue was closed.
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

0 participants