platform_external_selinux/libselinux
Nicolas Iooss 9d3091a6d3 libselinux: ensure that 4 columns are read from /proc/mounts
If exclude_non_seclabel_mounts() ever gets run on a kernel where
/proc/mounts only contains three columns, mount_info[3] will be used
"without being initialized in "strtok(mount_info[3], ",")" because
variable index would be 3 at the end of this loop:

    index = 0;
    item = strtok(buf, " ");
    while (item != NULL) {
        mount_info[index] = item;
        if (index == 3)
            break;
        index++;
        item = strtok(NULL, " ");
    }

Swap the condition on index and its increment so that it gets to 4 only
when there are at least four columns.

This issue has been found using clang's static analyzer.

Signed-off-by: Nicolas Iooss <nicolas.iooss@m4x.org>
2017-04-11 14:32:16 -04:00
..
include setfiles: Fix setfiles progress indicator 2017-01-27 09:39:22 -05:00
man setfiles: Fix setfiles progress indicator 2017-01-27 09:39:22 -05:00
src libselinux: ensure that 4 columns are read from /proc/mounts 2017-04-11 14:32:16 -04:00
utils libselinux: include errno.h instead of sys/errno.h 2017-01-09 16:00:22 -05:00
LICENSE initial import from svn trunk revision 2950 2008-08-19 15:30:36 -04:00
Makefile libselinux: Add clean-pywrap and clean-rubywrap targets 2016-10-27 10:35:37 -04:00
VERSION Update VERSION and ChangeLog files for 2.6 final release. 2016-10-14 11:31:26 -04:00