Hi Mike, it looks like you are not initializing the "len" parameter.
* \param buffer_len is the size of the buffer pointed to by the buffer parameter. * It'll be set to the actual data length upon return. If the data is NULL, length is -1. Patrick On Tue, Feb 7, 2012 at 12:12 PM, mfthom <[email protected]> wrote: > I'm having trouble with a c client doing an asynchronous get. This code: > #include <zookeeper.h> > #include <stdio.h> > #include <pthread.h> > #include <assert.h> > char *Z = "/fuzz/targets/targ0000000002"; > > int main(int argc, char **argv) { > static zhandle_t *zh = NULL; > char ip[8192]; > int len; > struct Stat stat; > printf("here here \n"); > zh = zookeeper_init("172.20.110.100:2181", NULL, 30000, 0, 0, 0); > int rc = zoo_get(zh, Z, 0, ip, &len, &stat); > if(rc != ZOK) > { > printf("crash\n"); > }else{ > printf("ip is %s len is %d\n", ip, len); > } > } > > will fail or work depending on the size of the ip array. 1024 works > usually. 8292 fails. > The failure symptom is that it returns a len of zero bytes instead of the > data (a simple IP address). > > And sometimes, zookeeper seg faults while doing memcpy. > > Thanks, > --Mike > > -- > View this message in context: > http://zookeeper-user.578899.n2.nabble.com/c-binding-asynchronous-get-problem-tp7263621p7263621.html > Sent from the zookeeper-user mailing list archive at Nabble.com.
