~ubuntu-branches/ubuntu/quantal/valgrind/quantal

« back to all changes in this revision

Viewing changes to coregrind/vgdb.c

  • Committer: Package Import Robot
  • Author(s): Julian Taylor
  • Date: 2012-10-05 20:16:28 UTC
  • Revision ID: package-import@ubuntu.com-20121005201628-iyyitwvtlb3xq380
Tags: 1:3.7.0-0ubuntu4
* fix-buffer-overflows.patch: fix overflows in vgdb
* 05_fix-callgrind_control.patch: fix valgrind process name (LP: #1036283)
* fix-VEX-PCMPxSTRx.patch: fix strstr handling (LP: #1027977)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1364
1364
static
1365
1365
Bool read_from_gdb_write_to_pid(int to_pid)
1366
1366
{
1367
 
   char buf[PBUFSIZ];
 
1367
   char buf[PBUFSIZ+1]; // +1 for trailing \0
1368
1368
   int nrread;
1369
1369
 
1370
1370
   nrread = read_buf(from_gdb, buf, "from gdb on stdin");
1388
1388
static
1389
1389
Bool read_from_pid_write_to_gdb(int from_pid)
1390
1390
{
1391
 
   char buf[PBUFSIZ];
 
1391
   char buf[PBUFSIZ+1]; // +1 for trailing \0
1392
1392
   int nrread;
1393
1393
 
1394
1394
   nrread = read_buf(from_pid, buf, "from pid");
1493
1493
static int
1494
1494
readchar (int fd)
1495
1495
{
1496
 
  static unsigned char buf[PBUFSIZ];
 
1496
  static unsigned char buf[PBUFSIZ+1]; // +1 for trailing \0
1497
1497
  static int bufcnt = 0;
1498
1498
  static unsigned char *bufp;
1499
1499
 
1500
1500
  if (bufcnt-- > 0)
1501
1501
     return *bufp++;
1502
1502
 
1503
 
  bufcnt = read (fd, buf, sizeof (buf));
 
1503
  bufcnt = read_buf (fd, buf, "static buf readchar");
1504
1504
 
1505
1505
  if (bufcnt <= 0) {
1506
1506
     if (bufcnt == 0) {
1874
1874
   unsigned char hex[3];
1875
1875
   unsigned char cksum;
1876
1876
   unsigned char *hexcommand;
1877
 
   unsigned char buf[PBUFSIZ];
 
1877
   unsigned char buf[PBUFSIZ+1]; // +1 for trailing \0
1878
1878
   int buflen;
1879
1879
   int nc;
1880
1880
 
2151
2151
         errno = 0; /* avoid complain if vgdb_dir is empty */
2152
2152
         while ((f = readdir (vgdb_dir))) {
2153
2153
            struct stat st;
2154
 
            char pathname[strlen(vgdb_dir_name) + strlen(f->d_name)];
 
2154
            char pathname[strlen(vgdb_dir_name) + strlen(f->d_name) + 1];
2155
2155
            char *wrongpid;
2156
2156
            int newpid;
2157
2157