xfs
[Top] [All Lists]

Patch to fix segmentation fault in libattr

To: linux-xfs@xxxxxxxxxxx
Subject: Patch to fix segmentation fault in libattr
From: Simon Munton <simon@xxxxxxxxxxxxxxxxxx>
Date: Tue, 21 Feb 2006 22:19:59 +0000
Sender: linux-xfs-bounce@xxxxxxxxxxx
User-agent: KMail/1.9.1
Hi

I found that using the attr command with the -l option could cause a 
segmentation fault.

I tracked the problem down to the attr_list function in libattr.c. This 
contains a loop that uses the value from the listxattr call to determine when 
the loop finishes. However, this value is overwritten in the loop by the call 
to getxattr.

The same problem also appears to be in attr_listf.

Following is patch to fix the problem.

Regards
Simon Munton

--- attr-2.4.28/libattr/libattr.c.orig  2006-01-13 03:16:52.000000000 +0000
+++ attr-2.4.28/libattr/libattr.c       2006-02-21 14:36:25.000000000 +0000
@@ -290,6 +290,8 @@
        end_offset = buffersize & ~(8-1);       /* 8 byte align */

        for (l = lbuf; l != lbuf + length; l = strchr(l, '\0') + 1) {
+               int length;
+
                if (api_unconvert(name, l, flags))
                        continue;
                if (flags & ATTR_DONTFOLLOW)
@@ -333,6 +335,8 @@
        end_offset = buffersize & ~(8-1);       /* 8 byte align */

        for (l = lbuf; l != lbuf + c; l = strchr(l, '\0') + 1) {
+               int c;
+
                if (api_unconvert(name, l, flags))
                        continue;
                c = fgetxattr(fd, l, NULL, 0);


<Prev in Thread] Current Thread [Next in Thread>