Skip to content

Commit ed99135

Browse files
cgzonespcmoore
authored andcommitted
selinux: keep context struct members in sync
Commit 53f3517 ("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: 53f3517 ("selinux: do not leave dangling pointer behind") Signed-off-by: Christian Göttsche <cgzones@googlemail.com> Signed-off-by: Paul Moore <paul@paul-moore.com>
1 parent 85c3222 commit ed99135

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

security/selinux/ss/context.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ static inline int context_cpy(struct context *dst, const struct context *src)
168168
if (rc) {
169169
kfree(dst->str);
170170
dst->str = NULL;
171+
dst->len = 0;
171172
return rc;
172173
}
173174
return 0;

0 commit comments

Comments
 (0)