The following issues were found
Lib/importlib/_abc.py
8 issues
Line: 2
Column: 1
"""Subset of importlib.abc used to reduce importlib.util imports."""
from . import _bootstrap
import abc
import warnings
class Loader(metaclass=abc.ABCMeta):
"""Abstract base class for import loaders."""
Reported by Pylint.
Line: 11
Column: 29
"""Abstract base class for import loaders."""
def create_module(self, spec):
"""Return a module to initialize and into which to load.
This method should raise ImportError if anything prevents it
from creating a new module. It may return None to indicate
that the spec should create the new module.
Reported by Pylint.
Line: 40
Column: 16
if not hasattr(self, 'exec_module'):
raise ImportError
# Warning implemented in _load_module_shim().
return _bootstrap._load_module_shim(self, fullname)
def module_repr(self, module):
"""Return a module's repr.
Used by the module type when the method does not raise
Reported by Pylint.
Line: 42
Column: 27
# Warning implemented in _load_module_shim().
return _bootstrap._load_module_shim(self, fullname)
def module_repr(self, module):
"""Return a module's repr.
Used by the module type when the method does not raise
NotImplementedError.
Reported by Pylint.
Line: 3
Column: 1
"""Subset of importlib.abc used to reduce importlib.util imports."""
from . import _bootstrap
import abc
import warnings
class Loader(metaclass=abc.ABCMeta):
"""Abstract base class for import loaders."""
Reported by Pylint.
Line: 4
Column: 1
"""Subset of importlib.abc used to reduce importlib.util imports."""
from . import _bootstrap
import abc
import warnings
class Loader(metaclass=abc.ABCMeta):
"""Abstract base class for import loaders."""
Reported by Pylint.
Line: 11
Column: 5
"""Abstract base class for import loaders."""
def create_module(self, spec):
"""Return a module to initialize and into which to load.
This method should raise ImportError if anything prevents it
from creating a new module. It may return None to indicate
that the spec should create the new module.
Reported by Pylint.
Line: 42
Column: 5
# Warning implemented in _load_module_shim().
return _bootstrap._load_module_shim(self, fullname)
def module_repr(self, module):
"""Return a module's repr.
Used by the module type when the method does not raise
NotImplementedError.
Reported by Pylint.
Lib/lib2to3/fixes/fix_itertools_imports.py
8 issues
Line: 16
Column: 28
def transform(self, node, results):
imports = results['imports']
if imports.type == syms.import_as_name or not imports.children:
children = [imports]
else:
children = imports.children
for child in children[::2]:
if child.type == token.NAME:
Reported by Pylint.
Line: 28
Column: 38
# Just leave the import as is.
return
else:
assert child.type == syms.import_as_name
name_node = child.children[0]
member_name = name_node.value
if member_name in ('imap', 'izip', 'ifilter'):
child.value = None
child.remove()
Reported by Pylint.
Line: 22
Column: 17
children = imports.children
for child in children[::2]:
if child.type == token.NAME:
member = child.value
name_node = child
elif child.type == token.STAR:
# Just leave the import as is.
return
else:
Reported by Pylint.
Line: 8
Column: 1
from lib2to3.fixer_util import BlankLine, syms, token
class FixItertoolsImports(fixer_base.BaseFix):
BM_compatible = True
PATTERN = """
import_from< 'from' 'itertools' 'import' imports=any >
""" %(locals())
Reported by Pylint.
Line: 14
Column: 5
import_from< 'from' 'itertools' 'import' imports=any >
""" %(locals())
def transform(self, node, results):
imports = results['imports']
if imports.type == syms.import_as_name or not imports.children:
children = [imports]
else:
children = imports.children
Reported by Pylint.
Line: 14
Column: 5
import_from< 'from' 'itertools' 'import' imports=any >
""" %(locals())
def transform(self, node, results):
imports = results['imports']
if imports.type == syms.import_as_name or not imports.children:
children = [imports]
else:
children = imports.children
Reported by Pylint.
Line: 28
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
# Just leave the import as is.
return
else:
assert child.type == syms.import_as_name
name_node = child.children[0]
member_name = name_node.value
if member_name in ('imap', 'izip', 'ifilter'):
child.value = None
child.remove()
Reported by Bandit.
Line: 54
Column: 13
# If there are no imports left, just get rid of the entire statement
if (not (imports.children or getattr(imports, 'value', None)) or
imports.parent is None):
p = node.prefix
node = BlankLine()
node.prefix = p
return node
Reported by Pylint.
Lib/lib2to3/fixes/fix_itertools.py
8 issues
Line: 11
Column: 1
"""
# Local imports
from .. import fixer_base
from ..fixer_util import Name
class FixItertools(fixer_base.BaseFix):
BM_compatible = True
it_funcs = "('imap'|'ifilter'|'izip'|'izip_longest'|'ifilterfalse')"
Reported by Pylint.
Line: 12
Column: 1
# Local imports
from .. import fixer_base
from ..fixer_util import Name
class FixItertools(fixer_base.BaseFix):
BM_compatible = True
it_funcs = "('imap'|'ifilter'|'izip'|'izip_longest'|'ifilterfalse')"
PATTERN = """
Reported by Pylint.
Line: 28
Column: 25
# Needs to be run after fix_(map|zip|filter)
run_order = 6
def transform(self, node, results):
prefix = None
func = results['func'][0]
if ('it' in results and
func.value not in ('ifilterfalse', 'izip_longest')):
dot, it = (results['dot'], results['it'])
Reported by Pylint.
Line: 14
Column: 1
from .. import fixer_base
from ..fixer_util import Name
class FixItertools(fixer_base.BaseFix):
BM_compatible = True
it_funcs = "('imap'|'ifilter'|'izip'|'izip_longest'|'ifilterfalse')"
PATTERN = """
power< it='itertools'
trailer<
Reported by Pylint.
Line: 14
Column: 1
from .. import fixer_base
from ..fixer_util import Name
class FixItertools(fixer_base.BaseFix):
BM_compatible = True
it_funcs = "('imap'|'ifilter'|'izip'|'izip_longest'|'ifilterfalse')"
PATTERN = """
power< it='itertools'
trailer<
Reported by Pylint.
Line: 28
Column: 5
# Needs to be run after fix_(map|zip|filter)
run_order = 6
def transform(self, node, results):
prefix = None
func = results['func'][0]
if ('it' in results and
func.value not in ('ifilterfalse', 'izip_longest')):
dot, it = (results['dot'], results['it'])
Reported by Pylint.
Line: 28
Column: 5
# Needs to be run after fix_(map|zip|filter)
run_order = 6
def transform(self, node, results):
prefix = None
func = results['func'][0]
if ('it' in results and
func.value not in ('ifilterfalse', 'izip_longest')):
dot, it = (results['dot'], results['it'])
Reported by Pylint.
Line: 33
Column: 18
func = results['func'][0]
if ('it' in results and
func.value not in ('ifilterfalse', 'izip_longest')):
dot, it = (results['dot'], results['it'])
# Remove the 'itertools'
prefix = it.prefix
it.remove()
# Replace the node which contains ('.', 'function') with the
# function (to be consistent with the second part of the pattern)
Reported by Pylint.
Lib/idlelib/idle_test/test_search.py
8 issues
Line: 4
Column: 1
"Test search, coverage 69%."
from idlelib import search
import unittest
from test.support import requires
requires('gui')
from tkinter import Tk, Text, BooleanVar
from idlelib import searchengine
Reported by Pylint.
Line: 5
Column: 1
from idlelib import search
import unittest
from test.support import requires
requires('gui')
from tkinter import Tk, Text, BooleanVar
from idlelib import searchengine
# Does not currently test the event handler wrappers.
Reported by Pylint.
Line: 7
Column: 1
import unittest
from test.support import requires
requires('gui')
from tkinter import Tk, Text, BooleanVar
from idlelib import searchengine
# Does not currently test the event handler wrappers.
# A usage test should simulate clicks and check highlighting.
# Tests need to be coordinated with SearchDialogBase tests
Reported by Pylint.
Line: 7
Column: 1
import unittest
from test.support import requires
requires('gui')
from tkinter import Tk, Text, BooleanVar
from idlelib import searchengine
# Does not currently test the event handler wrappers.
# A usage test should simulate clicks and check highlighting.
# Tests need to be coordinated with SearchDialogBase tests
Reported by Pylint.
Line: 8
Column: 1
from test.support import requires
requires('gui')
from tkinter import Tk, Text, BooleanVar
from idlelib import searchengine
# Does not currently test the event handler wrappers.
# A usage test should simulate clicks and check highlighting.
# Tests need to be coordinated with SearchDialogBase tests
# to avoid duplication.
Reported by Pylint.
Line: 16
Column: 1
# to avoid duplication.
class SearchDialogTest(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.root = Tk()
Reported by Pylint.
Line: 34
Column: 5
self.text = Text(self.root)
self.text.insert('1.0', 'Hello World!')
def test_find_again(self):
# Search for various expressions
text = self.text
self.engine.setpat('')
self.assertFalse(self.dialog.find_again(text))
Reported by Pylint.
Line: 59
Column: 5
self.engine.setpat('W[aeiouy]r')
self.assertTrue(self.dialog.find_again(text))
def test_find_selection(self):
# Select some text and make sure it's found
text = self.text
# Add additional line to find
self.text.insert('2.0', 'Hello World!')
Reported by Pylint.
Python/initconfig.c
8 issues
Line: 2250
Column: 5
CWE codes:
134
Suggestion:
Use a constant for the format specification
{
FILE *f = error ? stderr : stdout;
fprintf(f, usage_line, program);
if (error)
fprintf(f, "Try `python -h' for more information.\n");
else {
fputs(usage_1, f);
fputs(usage_2, f);
Reported by FlawFinder.
Line: 2257
Column: 9
CWE codes:
134
Suggestion:
Use a constant for the format specification
fputs(usage_1, f);
fputs(usage_2, f);
fputs(usage_3, f);
fprintf(f, usage_4, (wint_t)DELIM);
fprintf(f, usage_5, (wint_t)DELIM, PYTHONHOMEHELP);
fputs(usage_6, f);
}
}
Reported by FlawFinder.
Line: 2258
Column: 9
CWE codes:
134
Suggestion:
Use a constant for the format specification
fputs(usage_2, f);
fputs(usage_3, f);
fprintf(f, usage_4, (wint_t)DELIM);
fprintf(f, usage_5, (wint_t)DELIM, PYTHONHOMEHELP);
fputs(usage_6, f);
}
}
Reported by FlawFinder.
Line: 1379
Column: 23
CWE codes:
807
20
Suggestion:
Check environment variables carefully before using them
return PyConfig_SetString(config, dest, var);
#else
const char *var = getenv(name);
if (!var || var[0] == '\0') {
*dest = NULL;
return _PyStatus_OK();
}
Reported by FlawFinder.
Line: 1514
Column: 39
CWE codes:
807
20
Suggestion:
Check environment variables carefully before using them
}
#ifdef WITH_NEXT_FRAMEWORK
else {
const char* pyvenv_launcher = getenv("__PYVENV_LAUNCHER__");
if (pyvenv_launcher && *pyvenv_launcher) {
/* Used by Mac/Tools/pythonw.c to forward
* the argv0 of the stub executable
*/
status = CONFIG_SET_BYTES_STR(config,
Reported by FlawFinder.
Line: 2292
Column: 17
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
if (command == NULL) {
return _PyStatus_NO_MEMORY();
}
memcpy(command, _PyOS_optarg, (len - 2) * sizeof(wchar_t));
command[len - 2] = '\n';
command[len - 1] = 0;
config->run_command = command;
}
break;
Reported by FlawFinder.
Line: 1793
Column: 20
CWE codes:
126
const wchar_t *xoption = config_get_xoption(config, L"pycache_prefix");
if (xoption) {
const wchar_t *sep = wcschr(xoption, L'=');
if (sep && wcslen(sep) > 1) {
config->pycache_prefix = _PyMem_RawWcsdup(sep + 1);
if (config->pycache_prefix == NULL) {
return _PyStatus_NO_MEMORY();
}
}
Reported by FlawFinder.
Line: 2287
Column: 30
CWE codes:
126
/* -c is the last option; following arguments
that look like options are left for the
command to interpret. */
size_t len = wcslen(_PyOS_optarg) + 1 + 1;
wchar_t *command = PyMem_RawMalloc(sizeof(wchar_t) * len);
if (command == NULL) {
return _PyStatus_NO_MEMORY();
}
memcpy(command, _PyOS_optarg, (len - 2) * sizeof(wchar_t));
Reported by FlawFinder.
Programs/freeze_test_frozenmain.py
8 issues
Line: 1
Column: 1
import marshal
import tokenize
import os.path
import sys
PROGRAM_DIR = os.path.dirname(__file__)
SRC_DIR = os.path.dirname(PROGRAM_DIR)
Reported by Pylint.
Line: 10
Column: 1
SRC_DIR = os.path.dirname(PROGRAM_DIR)
def writecode(fp, mod, data):
print('unsigned char M_%s[] = {' % mod, file=fp)
indent = ' ' * 4
for i in range(0, len(data), 16):
print(indent, file=fp, end='')
for c in bytes(data[i:i+16]):
Reported by Pylint.
Line: 10
Column: 1
SRC_DIR = os.path.dirname(PROGRAM_DIR)
def writecode(fp, mod, data):
print('unsigned char M_%s[] = {' % mod, file=fp)
indent = ' ' * 4
for i in range(0, len(data), 16):
print(indent, file=fp, end='')
for c in bytes(data[i:i+16]):
Reported by Pylint.
Line: 15
Column: 13
indent = ' ' * 4
for i in range(0, len(data), 16):
print(indent, file=fp, end='')
for c in bytes(data[i:i+16]):
print('%d,' % c, file=fp, end='')
print('', file=fp)
print('};', file=fp)
Reported by Pylint.
Line: 21
Column: 1
print('};', file=fp)
def dump(fp, filename, name):
# Strip the directory to get reproducible marshal dump
code_filename = os.path.basename(filename)
with tokenize.open(filename) as source_fp:
source = source_fp.read()
Reported by Pylint.
Line: 21
Column: 1
print('};', file=fp)
def dump(fp, filename, name):
# Strip the directory to get reproducible marshal dump
code_filename = os.path.basename(filename)
with tokenize.open(filename) as source_fp:
source = source_fp.read()
Reported by Pylint.
Line: 33
Column: 1
writecode(fp, name, data)
def main():
if len(sys.argv) < 2:
print(f"usage: {sys.argv[0]} filename")
sys.exit(1)
filename = sys.argv[1]
Reported by Pylint.
Line: 39
Column: 33
sys.exit(1)
filename = sys.argv[1]
with open(filename, "w") as fp:
print("// Auto-generated by Programs/freeze_test_frozenmain.py", file=fp)
frozenmain = os.path.join(PROGRAM_DIR, 'test_frozenmain.py')
dump(fp, frozenmain, 'test_frozenmain')
print(f"{filename} written")
Reported by Pylint.
Programs/_testembed.c
8 issues
Line: 175
Column: 9
CWE codes:
134
Suggestion:
Use a constant for the format specification
* flushed progress messages make the broken API easier to find when they fail.
*/
#define _Py_EMBED_PREINIT_CHECK(msg) \
do {printf(msg); fflush(stdout);} while (0);
static int test_pre_initialization_api(void)
{
/* the test doesn't support custom memory allocators */
putenv("PYTHONMALLOC=");
Reported by FlawFinder.
Line: 1423
Column: 17
CWE codes:
807
20
Suggestion:
Check environment variables carefully before using them
static int test_init_setpath(void)
{
char *env = getenv("TESTPATH");
if (!env) {
error("missing TESTPATH env var");
return 1;
}
wchar_t *path = Py_DecodeLocale(env, NULL);
Reported by FlawFinder.
Line: 1456
Column: 17
CWE codes:
807
20
Suggestion:
Check environment variables carefully before using them
Py_ExitStatusException(status);
}
char *env = getenv("TESTPATH");
if (!env) {
error("missing TESTPATH env var");
return 1;
}
wchar_t *path = Py_DecodeLocale(env, NULL);
Reported by FlawFinder.
Line: 1485
Column: 17
CWE codes:
807
20
Suggestion:
Check environment variables carefully before using them
static int test_init_setpythonhome(void)
{
char *env = getenv("TESTHOME");
if (!env) {
error("missing TESTHOME env var");
return 1;
}
wchar_t *home = Py_DecodeLocale(env, NULL);
Reported by FlawFinder.
Line: 215
Column: 29
CWE codes:
126
*/
const wchar_t *static_warnoption = L"once";
const wchar_t *static_xoption = L"also_not_an_option=2";
size_t warnoption_len = wcslen(static_warnoption);
size_t xoption_len = wcslen(static_xoption);
wchar_t *dynamic_once_warnoption = \
(wchar_t *) calloc(warnoption_len+1, sizeof(wchar_t));
wchar_t *dynamic_xoption = \
(wchar_t *) calloc(xoption_len+1, sizeof(wchar_t));
Reported by FlawFinder.
Line: 216
Column: 26
CWE codes:
126
const wchar_t *static_warnoption = L"once";
const wchar_t *static_xoption = L"also_not_an_option=2";
size_t warnoption_len = wcslen(static_warnoption);
size_t xoption_len = wcslen(static_xoption);
wchar_t *dynamic_once_warnoption = \
(wchar_t *) calloc(warnoption_len+1, sizeof(wchar_t));
wchar_t *dynamic_xoption = \
(wchar_t *) calloc(xoption_len+1, sizeof(wchar_t));
wcsncpy(dynamic_once_warnoption, static_warnoption, warnoption_len+1);
Reported by FlawFinder.
Line: 221
Column: 5
CWE codes:
120
(wchar_t *) calloc(warnoption_len+1, sizeof(wchar_t));
wchar_t *dynamic_xoption = \
(wchar_t *) calloc(xoption_len+1, sizeof(wchar_t));
wcsncpy(dynamic_once_warnoption, static_warnoption, warnoption_len+1);
wcsncpy(dynamic_xoption, static_xoption, xoption_len+1);
_Py_EMBED_PREINIT_CHECK("Checking PySys_AddWarnOption\n");
PySys_AddWarnOption(L"default");
_Py_EMBED_PREINIT_CHECK("Checking PySys_ResetWarnOptions\n");
Reported by FlawFinder.
Line: 222
Column: 5
CWE codes:
120
wchar_t *dynamic_xoption = \
(wchar_t *) calloc(xoption_len+1, sizeof(wchar_t));
wcsncpy(dynamic_once_warnoption, static_warnoption, warnoption_len+1);
wcsncpy(dynamic_xoption, static_xoption, xoption_len+1);
_Py_EMBED_PREINIT_CHECK("Checking PySys_AddWarnOption\n");
PySys_AddWarnOption(L"default");
_Py_EMBED_PREINIT_CHECK("Checking PySys_ResetWarnOptions\n");
PySys_ResetWarnOptions();
Reported by FlawFinder.
Lib/tkinter/dialog.py
8 issues
Line: 11
Column: 5
class Dialog(Widget):
def __init__(self, master=None, cnf={}, **kw):
cnf = _cnfmerge((cnf, kw))
self.widgetName = '__dialog__'
Widget._setup(self, master, cnf)
self.num = self.tk.getint(
self.tk.call(
Reported by Pylint.
Line: 11
Column: 5
class Dialog(Widget):
def __init__(self, master=None, cnf={}, **kw):
cnf = _cnfmerge((cnf, kw))
self.widgetName = '__dialog__'
Widget._setup(self, master, cnf)
self.num = self.tk.getint(
self.tk.call(
Reported by Pylint.
Line: 1
Column: 1
# dialog.py -- Tkinter interface to the tk_dialog script.
from tkinter import _cnfmerge, Widget, TclError, Button, Pack
__all__ = ["Dialog"]
DIALOG_ICON = 'questhead'
Reported by Pylint.
Line: 10
Column: 1
DIALOG_ICON = 'questhead'
class Dialog(Widget):
def __init__(self, master=None, cnf={}, **kw):
cnf = _cnfmerge((cnf, kw))
self.widgetName = '__dialog__'
Widget._setup(self, master, cnf)
self.num = self.tk.getint(
Reported by Pylint.
Line: 21
Column: 14
cnf['title'], cnf['text'],
cnf['bitmap'], cnf['default'],
*cnf['strings']))
try: Widget.destroy(self)
except TclError: pass
def destroy(self): pass
Reported by Pylint.
Line: 22
Column: 26
cnf['bitmap'], cnf['default'],
*cnf['strings']))
try: Widget.destroy(self)
except TclError: pass
def destroy(self): pass
def _test():
Reported by Pylint.
Line: 24
Column: 24
try: Widget.destroy(self)
except TclError: pass
def destroy(self): pass
def _test():
d = Dialog(None, {'title': 'File Modified',
'text':
Reported by Pylint.
Line: 28
Column: 5
def _test():
d = Dialog(None, {'title': 'File Modified',
'text':
'File "Python.h" has been modified'
' since the last time it was saved.'
' Do you want to save it before'
' exiting the application.',
Reported by Pylint.
PCbuild/rmpyc.py
8 issues
Line: 8
Column: 5
import os
from os.path import join
npyc = 0
for root, dirs, files in os.walk(root):
for name in files:
# to be thorough
if name.endswith(('.pyc', '.pyo')):
npyc += 1
Reported by Pylint.
Line: 9
Column: 15
from os.path import join
npyc = 0
for root, dirs, files in os.walk(root):
for name in files:
# to be thorough
if name.endswith(('.pyc', '.pyo')):
npyc += 1
os.remove(join(root, name))
Reported by Pylint.
Line: 1
Column: 1
# Remove all the .pyc files under ../Lib.
def deltree(root):
import os
from os.path import join
npyc = 0
for root, dirs, files in os.walk(root):
Reported by Pylint.
Line: 4
Column: 1
# Remove all the .pyc files under ../Lib.
def deltree(root):
import os
from os.path import join
npyc = 0
for root, dirs, files in os.walk(root):
Reported by Pylint.
Line: 5
Column: 5
def deltree(root):
import os
from os.path import join
npyc = 0
for root, dirs, files in os.walk(root):
for name in files:
Reported by Pylint.
Line: 6
Column: 5
def deltree(root):
import os
from os.path import join
npyc = 0
for root, dirs, files in os.walk(root):
for name in files:
# to be thorough
Reported by Pylint.
Line: 9
Column: 9
from os.path import join
npyc = 0
for root, dirs, files in os.walk(root):
for name in files:
# to be thorough
if name.endswith(('.pyc', '.pyo')):
npyc += 1
os.remove(join(root, name))
Reported by Pylint.
Line: 18
Column: 1
return npyc
npyc = deltree("../Lib")
print(npyc, ".pyc deleted")
Reported by Pylint.
Modules/_ctypes/callproc.c
8 issues
Line: 275
CWE codes:
908
--n;
lpMsgBuf[n] = L'\0'; /* rstrip() */
}
return lpMsgBuf;
}
#ifndef DONT_USE_SEH
static void SetException(DWORD code, EXCEPTION_RECORD *pr)
{
Reported by Cppcheck.
Line: 1881
Column: 9
CWE codes:
120
Suggestion:
Use sprintf_s, snprintf, or vsnprintf
buf = PyMem_Malloc(strlen(name) + 3 + 1);
if (buf == NULL)
return PyErr_NoMemory();
sprintf(buf, "LP_%s", name);
result = PyObject_CallFunction((PyObject *)Py_TYPE(&PyCPointer_Type),
"s(O){}",
buf,
&PyCPointer_Type);
PyMem_Free(buf);
Reported by FlawFinder.
Line: 1899
Column: 9
CWE codes:
120
Suggestion:
Use sprintf_s, snprintf, or vsnprintf
buf = PyMem_Malloc(strlen(typ->tp_name) + 3 + 1);
if (buf == NULL)
return PyErr_NoMemory();
sprintf(buf, "LP_%s", typ->tp_name);
result = PyObject_CallFunction((PyObject *)Py_TYPE(&PyCPointer_Type),
"s(O){sO}",
buf,
&PyCPointer_Type,
"_type_", cls);
Reported by FlawFinder.
Line: 1245
Column: 17
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
if (IS_PASS_BY_REF(size)) {
void *tmp = alloca(size);
if (atypes[i]->type == FFI_TYPE_STRUCT)
memcpy(tmp, args[i].value.p, size);
else
memcpy(tmp, (void*)&args[i].value, size);
avalues[i] = tmp;
}
Reported by FlawFinder.
Line: 1247
Column: 17
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
if (atypes[i]->type == FFI_TYPE_STRUCT)
memcpy(tmp, args[i].value.p, size);
else
memcpy(tmp, (void*)&args[i].value, size);
avalues[i] = tmp;
}
else
#endif
Reported by FlawFinder.
Line: 1331
Column: 51
CWE codes:
126
code = GetLastError();
lpMsgBuf = FormatError(code);
if (lpMsgBuf) {
result = PyUnicode_FromWideChar(lpMsgBuf, wcslen(lpMsgBuf));
LocalFree(lpMsgBuf);
} else {
result = PyUnicode_FromString("<no description>");
}
return result;
Reported by FlawFinder.
Line: 1878
Column: 28
CWE codes:
126
const char *name = PyUnicode_AsUTF8(cls);
if (name == NULL)
return NULL;
buf = PyMem_Malloc(strlen(name) + 3 + 1);
if (buf == NULL)
return PyErr_NoMemory();
sprintf(buf, "LP_%s", name);
result = PyObject_CallFunction((PyObject *)Py_TYPE(&PyCPointer_Type),
"s(O){}",
Reported by FlawFinder.
Line: 1896
Column: 28
CWE codes:
126
}
} else if (PyType_Check(cls)) {
typ = (PyTypeObject *)cls;
buf = PyMem_Malloc(strlen(typ->tp_name) + 3 + 1);
if (buf == NULL)
return PyErr_NoMemory();
sprintf(buf, "LP_%s", typ->tp_name);
result = PyObject_CallFunction((PyObject *)Py_TYPE(&PyCPointer_Type),
"s(O){sO}",
Reported by FlawFinder.