centos 7
integer weakness #15


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.

                 // If our copy pointer is the same
                // or less than the starting point,
                // there is no data here
                if( cp_p <= cp ) {
                        if( val_m->emptyIsNone == 1 ) {
                                return Py_None;
                        if( val_m->emptyValue != NULL ) {
                                workstr = (const char *)val_m->emptyValue;
                } 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;

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.