ps: address a potential 'newline' quirk the libselinux
Sometimes with libselinux present but SELinux inactive the context reported is "unconfined" which contains an embedded newline. This then causes misalignment of any subsequent data. So, ps will now protect against that. Reference(s): http://www.freelists.org/post/procps/enablelibselinux-switch,14 Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
parent
46a1356219
commit
7c4894dd22
@ -1339,6 +1339,7 @@ static int pr_context(char *restrict const outbuf, const proc_t *restrict const
|
||||
len = strlen(context);
|
||||
if(len > max_len) len = max_len;
|
||||
memcpy(outbuf, context, len);
|
||||
if (outbuf[len-1] == '\n') --len;
|
||||
outbuf[len] = '\0';
|
||||
free(context);
|
||||
}else{
|
||||
|
Loading…
Reference in New Issue
Block a user