andreiz / php-zookeeper

A PHP extension for interfacing with Apache ZooKeeper
Other
449 stars 215 forks source link

node with null data cause php segfault at Zookeeper::get($path) #21

Closed xiaozhiwen closed 9 years ago

xiaozhiwen commented 11 years ago

In php_zookeeper.c:334

static PHP_METHOD(Zookeeper, get)
{
...
    //!! zoo_wget set length = -1 indicate that buffer is null, 
    status = zoo_wget(i_obj->zk, path, (fci.size != 0) ? php_zk_watcher_marshal : NULL,
                      cb_data, buffer, &length, &stat);
     //!! length = -1
     buffer[length] = 0;
...

    //!! length=-1 for RETURN_STRINGL, suppose
    //!! if (length == -1) RETURN_NULL();
    RETURN_STRINGL(buffer, length, 0);
}
ryanuber commented 11 years ago

Hi,

I submitted pull #22 for this. It also fixes setting / creating null's.

faabiosr commented 9 years ago

Please close this issue!