mirror of
https://github.com/radareorg/radare2.git
synced 2024-12-04 19:47:31 +00:00
Fix double close in thread-list and non-null terminated string in debug.linux.core
This commit is contained in:
parent
7ff42b590f
commit
8d9e4a7836
@ -108,6 +108,7 @@ static prpsinfo_t *linux_get_prpsinfo(RDebug *dbg, proc_per_process_t *proc_data
|
||||
}
|
||||
|
||||
strncpy (p->pr_psargs, ppsargs, sizeof (p->pr_psargs));
|
||||
p->pr_psargs[sizeof (p->pr_psargs)-1] = 0;
|
||||
free (buffer);
|
||||
free (ppsargs);
|
||||
free (pfname);
|
||||
|
@ -152,10 +152,14 @@ RList *linux_thread_list (int pid, RList *list) {
|
||||
#define MAXPID 99999
|
||||
for (i = pid; i < MAXPID; i++) { // XXX
|
||||
snprintf (cmdline, sizeof(cmdline), "/proc/%d/status", i);
|
||||
if (fd != -1)
|
||||
if (fd != -1) {
|
||||
close (fd);
|
||||
fd = -1;
|
||||
}
|
||||
fd = open (cmdline, O_RDONLY);
|
||||
if (fd == -1) continue;
|
||||
if (fd == -1) {
|
||||
continue;
|
||||
}
|
||||
if (read (fd, cmdline, 1024)<2) {
|
||||
// read error
|
||||
close (fd);
|
||||
@ -167,6 +171,7 @@ RList *linux_thread_list (int pid, RList *list) {
|
||||
int tgid = atoi (ptr + 5);
|
||||
if (tgid != pid) {
|
||||
close (fd);
|
||||
fd = -1;
|
||||
continue;
|
||||
}
|
||||
if (read (fd, cmdline, sizeof(cmdline) - 1) <2) {
|
||||
|
Loading…
Reference in New Issue
Block a user