tag 524655 + confirmed upstream patch pending
thanks

Hi Csaba,

forwarding you a bug report mentioning that the size=0 API is not
honored in python-fuse. The attached patch fixes it (it comes from this
more detailed bug report [0]), and looks OK to me; would you consider
including in your upstream code ?

Cheers,

--Seb

[0] : https://bugs.launchpad.net/ubuntu/+source/python-fuse/+bug/325860
--- fuseparts/_fusemodule.c	2009-02-05 16:03:57.000000000 -0200
+++ 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);
 	}

Reply via email to