• Qualys Security Advisory's avatar
    pmap: Fix extended mode in one_proc(). · 8476e6f4
    Qualys Security Advisory authored
    Check the return value of sscanf() to make sure that all input items are
    properly initialized.
    In extended mode (x_option), one_proc() loads the values of start and
    perms during one iteration of the while loop, and displays them during
    one of the following iterations, but start and perms are variables local
    to the while loop: move them out of the while loop, to the beginning of
    the function.
    Also, display a mapping only if cp2 is properly initialized; otherwise
    (for example), mappings that do not belong to a selected range are
    displayed, and with a NULL mapping name:
    $ pmap -x -A 6FFF00000000,7FFF00000000 $$
    Address           Kbytes     RSS   Dirty Mode  Mapping
    000055b3d1e9b000       0     912       0  r-xp (null)
    000055b3d2194000       0      16      16  r--p (null)
    000055b3d2198000       0      36      36  rw-p (null)
pmap.c 31.3 KB