Bug 3370 - slurp (int pid, const char* name) is limited to /proc/$$ of BUFSIZ (4k) or less
Summary: slurp (int pid, const char* name) is limited to /proc/$$ of BUFSIZ (4k) or less
Status: RESOLVED FIXED
Alias: None
Product: frysk
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: Phil Muldoon
URL:
Keywords:
Depends on:
Blocks: 2243
  Show dependency treegraph
 
Reported: 2006-10-16 14:48 UTC by Phil Muldoon
Modified: 2007-10-10 17:05 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Phil Muldoon 2006-10-16 14:48:40 UTC
MapsBuilder use slurp like this:

jboolean
frysk::sys::proc::MapsBuilder::construct (jint pid)
{
  jbyteArray buf = slurp (pid, "maps");
  if (buf == NULL)
    return false;
  buildBuffer (buf);
  return construct (buf);
}

slurp (int pid, const char* name) is limited to reading files of up to BUFSIZ
which is 4K. 

A side effect of this is that any /proc/$$ file read will be truncated if > BUFSIZ.

This particular function slurp should read the whole map file.
Comment 1 Phil Muldoon 2006-10-16 21:20:40 UTC
006-10-16  Phil Muldoon  <pmuldoon@redhat.com>

        * cni/slurp.cxx (uslurp): New function. Read /proc/$$/{file} 4K chunks
        until len of last read = 0
Comment 2 Phil Muldoon 2006-11-28 15:18:46 UTC
This still needs a testcase. Will add to todo
Comment 3 Phil Muldoon 2007-10-10 17:05:34 UTC
2006-10-16  Phil Muldoon  <pmuldoon@redhat.com>

        * cni/MapsBuilder.cxx (construct): Don't terminate end of map line
        as a space, instead use \n.
        * cni/slurp.cxx (uslurp): New function. Read /proc/$$/{file} 4K chunks
        until len of last read = 0