--- fuseparts/_fusemodule.c 2009-02-05 16:03:57.000000000 -0200 +++ ../python-fuse-devel/fuseparts/_fusemodule.c 2009-02-05 15:16:47.000000000 -0200 @@ -676,8 +676,22 @@ #endif if(PyString_Check(v)) { - if(PyString_Size(v) > size) + /* size zero can be passed into these calls to return the current size of + * the named extended attribute + */ + if (size == 0) { + ret = PyString_Size(v); goto OUT_DECREF; + } + + /* If the size of the value buffer is too small to hold the result, errno + * is set to ERANGE. + */ + if (PyString_Size(v) > size) { + ret = -ERANGE; + goto OUT_DECREF; + } + memcpy(value, PyString_AsString(v), PyString_Size(v)); ret = PyString_Size(v); }