Package: python-fuse
Version: 1:0.2-pre3-9
Severity: normal
Tags: patch
User: ubuntu-de...@lists.ubuntu.com
Usertags: origin-ubuntu jaunty ubuntu-patch

Hi,

A Ubuntu user has noticed an issue[0] whereby the size=0 API is not
respected in python-fuse, and has produced a patch. More information is
available on the bug report referenced below. As we have nobody in
the MOTU team who is familiar with this code to judge whether the patch
is correct, and have had no success contacting the project's mailing
list (mails silently dropped), I'm sending the patch here for your
consideration.

I'd appreciate it if you could take a look at the patch and apply it to
the package, and bring it to upstream's attention if it is both
acceptable and you are able to do so.

Thanks for your time,
Iain

[0]
https://bugs.launchpad.net/ubuntu/+source/python-fuse/+bug/325860

-- System Information:
Debian Release: 5.0
  APT prefers jaunty-updates
  APT policy: (500, 'jaunty-updates'), (500, 'jaunty-security'), (500, 
'jaunty-proposed'), (500, 'jaunty-backports'), (500, 'jaunty')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.28-11-generic (SMP w/2 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8) (ignored: LC_ALL 
set to en_GB.UTF-8)
Shell: /bin/sh linked to /bin/dash
--- 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);
 	}

Reply via email to