~ubuntu-branches/ubuntu/lucid/qps/lucid

« back to all changes in this revision

Viewing changes to proc_linux.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Philipp Spitzer
  • Date: 2009-11-30 19:42:18 UTC
  • Revision ID: james.westby@ubuntu.com-20091130194218-jnt3mxw2coc1mic8
Tags: 1.9.18.6-2.3
* Non-maintainer upload.
* Increased the buffer size like suggested by Wolfgang Weisselberg in the
  bug report and closed a potential buffer overflow risk (also pointed out
  at the bug report). Closes: #527444

Show diffs side-by-side

added added

removed removed

Lines of Context:
666
666
void Procinfo::read_common()
667
667
{
668
668
        char path[80];
669
 
        char buf[4096 + 1];
 
669
        char buf[16384 + 1];
670
670
 
671
671
        char *p;
672
672
        int n;
797
797
        // cpu_time(CPUTIME_IDLE) incorrectly, since it doesn't take the number of
798
798
        // cpus into account. This is fixed in 2.1.x kernels, and since 2.0.x
799
799
        // is rather old (and unsuited for SMP anyway) we don't work around it.
800
 
        p = strstr(buf, "btime") + 6;
 
800
        p = strstr(buf, "btime ");
 
801
        if (!p) {
 
802
                fprintf(stderr, "Error reading btime\n");
 
803
                abort();
 
804
        }
 
805
        p += 6; // length("btime ")
801
806
        sscanf(p, "%lu", &boot_time);
802
807
}
803
808