Commit ed99135f authored by Christian Göttsche's avatar Christian Göttsche Committed by Paul Moore
Browse files

selinux: keep context struct members in sync



Commit 53f3517a ("selinux: do not leave dangling pointer behind")
reset the `str` field of the `context` struct in an OOM error branch.
In this struct the fields `str` and `len` are coupled and should be kept
in sync.  Set the length to zero according to the string be set to NULL.

Fixes: 53f3517a ("selinux: do not leave dangling pointer behind")
Signed-off-by: default avatarChristian Göttsche <cgzones@googlemail.com>
Signed-off-by: default avatarPaul Moore <paul@paul-moore.com>
parent 85c3222d
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -168,6 +168,7 @@ static inline int context_cpy(struct context *dst, const struct context *src)
	if (rc) {
		kfree(dst->str);
		dst->str = NULL;
		dst->len = 0;
		return rc;
	}
	return 0;