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);
|