diff options
Diffstat (limited to 'fs/proc/base.c')
-rw-r--r-- | fs/proc/base.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/fs/proc/base.c b/fs/proc/base.c index d513987d8..fa7ff052d 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c @@ -160,6 +160,24 @@ static int proc_pid_cmdline(struct task_struct *task, char * buffer) if (len > PAGE_SIZE) len = PAGE_SIZE; res = access_process_vm(task, mm->arg_start, buffer, len, 0); + // If the nul at the end of args has been overwritten, then + // assume application is using setproctitle(3). + if ( res > 0 && buffer[res-1] != '\0' ) + { + len = strnlen( buffer, res ); + if ( len < res ) + { + res = len; + } + else + { + len = mm->env_end - mm->env_start; + if (len > PAGE_SIZE - res) + len = PAGE_SIZE - res; + res += access_process_vm(task, mm->env_start, buffer+res, len, 0); + res = strnlen( buffer, res ); + } + } mmput(mm); } return res; @@ -285,7 +303,7 @@ static struct file_operations proc_info_file_operations = { }; #define MAY_PTRACE(p) \ -(p==current||(p->p_pptr==current&&(p->flags&PF_PTRACED)&&p->state==TASK_STOPPED)) +(p==current||(p->p_pptr==current&&(p->ptrace&PT_PTRACED)&&p->state==TASK_STOPPED)) static ssize_t mem_read(struct file * file, char * buf, size_t count, loff_t *ppos) |