Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#1197 mibgroup/host: fix hrSWRunPerfCPU and hrSWRunPerfMem

closed
Wes Hardaker
None
5
2013-11-08
2012-01-25
Vincent Bernat
No

/proc/<pid>/stat was improperly parsed. When skipping a field, a while
loop is used:

    while \( ' ' \!= \*\(cp++\)\)
        ;

After the execution of the while loop, `*cp` is a non-space
character. There is no need to increment `cp` again. Moreover, the
loop to skip 11 elements only skipped 10 elements. Same for the loop
that needed to skip 9 elements: only 8 elements were skipped.

Tested on NetSNMP 5.7.1 and on master. 5.4 does not have this code.

Discussion

  • Vincent Bernat
    Vincent Bernat
    2012-01-26

    Applies on 5.5, 5.6 and 5.7 branches.

     
  • Vincent Bernat
    Vincent Bernat
    2012-01-26

    I have added a second patch checking if *cp is not '\0' at various stages.

     
  • Wes Hardaker
    Wes Hardaker
    2012-07-31

    Fails to apply anywhere at the moment.

     
  • Vincent Bernat
    Vincent Bernat
    2012-07-31

    It seems that the patch has been already applied in 0f84fbcf71995bddafab500d87c9c5a6f461a734

    This is not the exact same patch but the issue seems to be fixed.

     
  • Wes Hardaker
    Wes Hardaker
    2012-07-31

    ok, thanks for the analysis then! And the patch!