aboutsummaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/pseudo/files/xattr_fix.patch
blob: 61d0030b103067ed584a80c28cf02f9b46b8ae89 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
In the xattr handling functions, if result is NULL, which it can be 
with the path ignore code, there is a NULL pointer dereference and 
segfault. Everywhere else checks result first, this appears to just 
be an omission.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Upstream-Status: Pending

Index: git/ports/linux/xattr/pseudo_wrappers.c
===================================================================
--- git.orig/ports/linux/xattr/pseudo_wrappers.c
+++ git/ports/linux/xattr/pseudo_wrappers.c
@@ -134,7 +134,7 @@ static ssize_t shared_getxattr(const cha
 	pseudo_debug(PDBGF_XATTR, "getxattr(%s [fd %d], %s)\n",
 		path ? path : "<no path>", fd, name);
 	pseudo_msg_t *result = pseudo_client_op(OP_GET_XATTR, 0, fd, -1, path, &buf, name);
-	if (result->result != RESULT_SUCCEED) {
+	if (!result || result->result != RESULT_SUCCEED) {
 		errno = ENOATTR;
 		return -1;
 	}
@@ -254,7 +254,7 @@ static int shared_setxattr(const char *p
 static ssize_t shared_listxattr(const char *path, int fd, char *list, size_t size) {
 	RC_AND_BUF
 	pseudo_msg_t *result = pseudo_client_op(OP_LIST_XATTR, 0, fd, -1, path, &buf);
-	if (result->result != RESULT_SUCCEED) {
+	if (!result || result->result != RESULT_SUCCEED) {
 		pseudo_debug(PDBGF_XATTR, "listxattr: no success.\n");
 		errno = ENOATTR;
 		return -1;
@@ -276,7 +276,7 @@ static int shared_removexattr(const char
 	RC_AND_BUF
 	pseudo_msg_t *result = pseudo_client_op(OP_REMOVE_XATTR, 0, fd, -1, path, &buf, name);
 
-	if (result->result != RESULT_SUCCEED) {
+	if (!result || result->result != RESULT_SUCCEED) {
 		/* docs say ENOATTR, but I don't have one */
 		errno = ENOENT;
 		return -1;