The following issues were found

Include/pyerrors.h
2 issues
printf - If format strings can be influenced by an attacker, they can be exploited
Security

Line: 311 Column: 50 CWE codes: 134
Suggestion: Use a constant for the format specification

                  );

PyAPI_FUNC(int) PyOS_snprintf(char *str, size_t size, const char  *format, ...)
                        Py_GCC_ATTRIBUTE((format(printf, 3, 4)));
PyAPI_FUNC(int) PyOS_vsnprintf(char *str, size_t size, const char  *format, va_list va)
                        Py_GCC_ATTRIBUTE((format(printf, 3, 0)));

#ifndef Py_LIMITED_API
#  define Py_CPYTHON_ERRORS_H

            

Reported by FlawFinder.

printf - If format strings can be influenced by an attacker, they can be exploited
Security

Line: 313 Column: 50 CWE codes: 134
Suggestion: Use a constant for the format specification

              PyAPI_FUNC(int) PyOS_snprintf(char *str, size_t size, const char  *format, ...)
                        Py_GCC_ATTRIBUTE((format(printf, 3, 4)));
PyAPI_FUNC(int) PyOS_vsnprintf(char *str, size_t size, const char  *format, va_list va)
                        Py_GCC_ATTRIBUTE((format(printf, 3, 0)));

#ifndef Py_LIMITED_API
#  define Py_CPYTHON_ERRORS_H
#  include  "cpython/pyerrors.h"
#  undef Py_CPYTHON_ERRORS_H

            

Reported by FlawFinder.

Include/internal/pycore_blocks_output_buffer.h
2 issues
memcpy - Does not check for buffer overflows when copying to destination
Security

Line: 293 Column: 13 CWE codes: 120
Suggestion: Make sure destination can always hold the source data

                      Py_ssize_t i = 0;
        for (; i < list_len-1; i++) {
            block = PyList_GET_ITEM(buffer->list, i);
            memcpy(posi, PyBytes_AS_STRING(block), Py_SIZE(block));
            posi += Py_SIZE(block);
        }
        // the last block
        block = PyList_GET_ITEM(buffer->list, i);
        memcpy(posi, PyBytes_AS_STRING(block), Py_SIZE(block) - avail_out);

            

Reported by FlawFinder.

memcpy - Does not check for buffer overflows when copying to destination
Security

Line: 298 Column: 9 CWE codes: 120
Suggestion: Make sure destination can always hold the source data

                      }
        // the last block
        block = PyList_GET_ITEM(buffer->list, i);
        memcpy(posi, PyBytes_AS_STRING(block), Py_SIZE(block) - avail_out);
    } else {
        assert(Py_SIZE(result) == 0);
    }

    Py_CLEAR(buffer->list);

            

Reported by FlawFinder.

Lib/idlelib/zzdummy.py
2 issues
Unused argument 'event'
Error

Line: 15 Column: 21

                  "Apply a formatting function to all of the selected lines."

    @wraps(format_line)
    def apply(self, event=None):
        head, tail, chars, lines = self.formatter.get_region()
        for pos in range(len(lines) - 1):
            line = lines[pos]
            lines[pos] = format_line(self, line)
        self.formatter.set_region(head, tail, chars, lines)

            

Reported by Pylint.

standard import "from functools import wraps" should be placed before "from idlelib.config import idleConf"
Error

Line: 8 Column: 1

              """

from idlelib.config import idleConf
from functools import wraps


def format_selection(format_line):
    "Apply a formatting function to all of the selected lines."


            

Reported by Pylint.

Include/cpython/bytesobject.h
2 issues
char - Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues
Security

Line: 8 Column: 5 CWE codes: 119 120
Suggestion: Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length

              typedef struct {
    PyObject_VAR_HEAD
    Py_hash_t ob_shash;
    char ob_sval[1];

    /* Invariants:
     *     ob_sval contains space for 'ob_size+1' elements.
     *     ob_sval[ob_size] == 0.
     *     ob_shash is the hash of the byte string or -1 if not computed yet.

            

Reported by FlawFinder.

char - Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues
Security

Line: 64 Column: 5 CWE codes: 119 120
Suggestion: Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length

              
    /* Stack buffer */
    int use_small_buffer;
    char small_buffer[512];
} _PyBytesWriter;

/* Initialize a bytes writer

   By default, the overallocation is disabled. Set the overallocate attribute

            

Reported by FlawFinder.

Include/bytesobject.h
2 issues
printf - If format strings can be influenced by an attacker, they can be exploited
Security

Line: 38 Column: 58 CWE codes: 134
Suggestion: Use a constant for the format specification

              PyAPI_FUNC(PyObject *) PyBytes_FromString(const char *);
PyAPI_FUNC(PyObject *) PyBytes_FromObject(PyObject *);
PyAPI_FUNC(PyObject *) PyBytes_FromFormatV(const char*, va_list)
                                Py_GCC_ATTRIBUTE((format(printf, 1, 0)));
PyAPI_FUNC(PyObject *) PyBytes_FromFormat(const char*, ...)
                                Py_GCC_ATTRIBUTE((format(printf, 1, 2)));
PyAPI_FUNC(Py_ssize_t) PyBytes_Size(PyObject *);
PyAPI_FUNC(char *) PyBytes_AsString(PyObject *);
PyAPI_FUNC(PyObject *) PyBytes_Repr(PyObject *, int);

            

Reported by FlawFinder.

printf - If format strings can be influenced by an attacker, they can be exploited
Security

Line: 40 Column: 58 CWE codes: 134
Suggestion: Use a constant for the format specification

              PyAPI_FUNC(PyObject *) PyBytes_FromFormatV(const char*, va_list)
                                Py_GCC_ATTRIBUTE((format(printf, 1, 0)));
PyAPI_FUNC(PyObject *) PyBytes_FromFormat(const char*, ...)
                                Py_GCC_ATTRIBUTE((format(printf, 1, 2)));
PyAPI_FUNC(Py_ssize_t) PyBytes_Size(PyObject *);
PyAPI_FUNC(char *) PyBytes_AsString(PyObject *);
PyAPI_FUNC(PyObject *) PyBytes_Repr(PyObject *, int);
PyAPI_FUNC(void) PyBytes_Concat(PyObject **, PyObject *);
PyAPI_FUNC(void) PyBytes_ConcatAndDel(PyObject **, PyObject *);

            

Reported by FlawFinder.

Lib/http/__init__.py
2 issues
Missing module docstring
Error

Line: 1 Column: 1

              from enum import IntEnum, _simple_enum

__all__ = ['HTTPStatus']


@_simple_enum(IntEnum)
class HTTPStatus:
    """HTTP status codes and reason phrases


            

Reported by Pylint.

Too few public methods (1/2)
Error

Line: 7 Column: 1

              

@_simple_enum(IntEnum)
class HTTPStatus:
    """HTTP status codes and reason phrases

    Status codes from the following RFCs are all observed:

        * RFC 7231: Hypertext Transfer Protocol (HTTP/1.1), obsoletes 2616

            

Reported by Pylint.

Lib/ctypes/test/__main__.py
2 issues
Unused load_tests imported from ctypes.test
Error

Line: 1 Column: 1

              from ctypes.test import load_tests
import unittest

unittest.main()

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              from ctypes.test import load_tests
import unittest

unittest.main()

            

Reported by Pylint.

Lib/ensurepip/__main__.py
2 issues
Access to a protected member _main of a client class
Error

Line: 5 Column: 14

              import sys

if __name__ == "__main__":
    sys.exit(ensurepip._main())

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              import ensurepip
import sys

if __name__ == "__main__":
    sys.exit(ensurepip._main())

            

Reported by Pylint.

Lib/email/mime/text.py
2 issues
Unused Charset imported from email.charset
Error

Line: 9 Column: 1

              
__all__ = ['MIMEText']

from email.charset import Charset
from email.mime.nonmultipart import MIMENonMultipart



class MIMEText(MIMENonMultipart):

            

Reported by Pylint.

XXX: This can be removed once #7304 is fixed.
Error

Line: 31 Column: 3

              
        # If no _charset was specified, check to see if there are non-ascii
        # characters present. If not, use 'us-ascii', otherwise use utf-8.
        # XXX: This can be removed once #7304 is fixed.
        if _charset is None:
            try:
                _text.encode('us-ascii')
                _charset = 'us-ascii'
            except UnicodeEncodeError:

            

Reported by Pylint.

Lib/lib2to3/__main__.py
2 issues
Attempted relative import beyond top-level package
Error

Line: 2 Column: 1

              import sys
from .main import main

sys.exit(main("lib2to3.fixes"))

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              import sys
from .main import main

sys.exit(main("lib2to3.fixes"))

            

Reported by Pylint.