centos 7
integer weakness #16


Weakness Breakdown


An integer overflow occurs when the answer to an arithmetic operation exceeds the maximum size of the integer type used to store it. The resulting value will appear to have wrapped around the maximum value and started again at the minimum value. This would look like a clock that represents 13:00 by pointing at 1:00. An attacker can use an integer overflow during a buffer length calculation, which results in the allocated buffer being too small to hold the data copied into it, thus causing a buffer overflow.

Warning code(s):

Unless checked, the resulting number can exceed the expected range.

File Name:



The highlighted line of code below is the trigger point of this particular Centos 7 integer weakness.

                } else {

        if( workstr == NULL ) {
                workstr = instr;

        switch( val_m->type_value ) {
        case ptzINT:
        case ptzLIST_INT:
                value = PyInt_FromLong(atoi(workstr));

        case ptzFLOAT:
        case ptzLIST_FLOAT:
                value = PyFloat_FromDouble(atof(workstr));

        case ptzBOOL:
        case ptzLIST_BOOL:
                value = PyBool_FromLong((atoi(workstr) == 1 ? 1:0));

        case ptzSTR:
        case ptzLIST_STR:
                value = PyString_FromString(workstr);

                log_append(logp, LOGFL_NODUPS, LOG_WARNING,
			   "Invalid type '%i' for value '%s'",
			   val_m->type_value, instr);
                value = Py_None;
        return value;

 * Retrieves a value from the data XML doc (via XPath Context) based on a XPath query
 * @author David Sommerseth <davids@redhat.com>
 * @param xmlXPathContext*  Pointer to the XPath context holding the source data
 * @param const char*       The XPath expression where to find the data
 * @return xmlXPathObject*  If data is found, it is returned in an XPath object for further processing

The registered trademark Linux® is used pursuant to a sublicense from the Linux Foundation, the exclusive licensee of Linus Torvalds, owner of the mark on a world­wide basis.