security labels can contain any printable ASCII

This commit is contained in:
albert 2005-01-05 20:09:03 +00:00
parent dfd72b363c
commit 2e78a17eda
2 changed files with 8 additions and 4 deletions

4
NEWS
View File

@ -1,3 +1,7 @@
procps-3.2.4 --> procps-3.2.5
ps: security labels can contain any printable ASCII
procps-3.2.3 --> procps-3.2.4
support 64-bit MIPS with n32 binary

View File

@ -1087,7 +1087,7 @@ static int pr_context(char *restrict const outbuf, const proc_t *restrict const
// wchan file is suitable for testing
//snprintf(filename, sizeof filename, "/proc/%d/wchan", pp->tgid);
snprintf(filename, sizeof filename, "/proc/%d/attr/current", pp->tgid);
snprintf(filename, sizeof filename, "/proc/%d/attr/current", pp->tgid);
fd = open(filename, O_RDONLY, 0);
if(likely(fd==-1)) goto fail;
@ -1096,10 +1096,10 @@ static int pr_context(char *restrict const outbuf, const proc_t *restrict const
if(unlikely(num_read<=0)) goto fail;
outbuf[num_read] = '\0';
len = strspn(outbuf, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ:_0123456789/^");
if(!len) goto fail;
len = 0;
while(outbuf[len]>' ' && outbuf[len]<='~') len++;
outbuf[len] = '\0';
return len;
if(len) return len;
fail:
outbuf[0] = '-';