Teach gcore about the pathname field of '/proc/*/map' so that it doesn't

spin when its parser gets confused by a lack of end-of-line.

Submitted by:	Dan Nelson <dan@dan.emsphone.com>
PR:		68839
This commit is contained in:
Robert Watson 2004-07-12 20:19:40 +00:00
parent f3ce707a18
commit 22c1471434

View File

@ -504,10 +504,10 @@ readmap(pid_t pid)
len = 0;
n = sscanf(mapbuf + pos, "%x %x %*d %*d %*x %3[-rwx]"
" %*d %*d %*x %*s %*s %16s%*[\n]%n",
" %*d %*d %*x %*s %*s %16s %*s%*[\n]%n",
&start, &end, prot, type, &len);
if (n != 4)
errx(1, "ill-formed line in %s", mapname);
if (n != 4 || len == 0)
errx(1, "ill-formed line in %s starting at character %d", mapname, pos + 1);
pos += len;
/* Ignore segments of the wrong kind, and unwritable ones */