The following issues were found
collectors/python.d.plugin/python_modules/pyyaml2/composer.py
66 issues
Line: 5
Column: 1
__all__ = ['Composer', 'ComposerError']
from error import MarkedYAMLError
from events import *
from nodes import *
class ComposerError(MarkedYAMLError):
pass
Reported by Pylint.
Line: 6
Column: 1
__all__ = ['Composer', 'ComposerError']
from error import MarkedYAMLError
from events import *
from nodes import *
class ComposerError(MarkedYAMLError):
pass
Reported by Pylint.
Line: 7
Column: 1
from error import MarkedYAMLError
from events import *
from nodes import *
class ComposerError(MarkedYAMLError):
pass
class Composer(object):
Reported by Pylint.
Line: 19
Column: 12
def check_node(self):
# Drop the STREAM-START event.
if self.check_event(StreamStartEvent):
self.get_event()
# If there are more documents available?
return not self.check_event(StreamEndEvent)
Reported by Pylint.
Line: 19
Column: 29
def check_node(self):
# Drop the STREAM-START event.
if self.check_event(StreamStartEvent):
self.get_event()
# If there are more documents available?
return not self.check_event(StreamEndEvent)
Reported by Pylint.
Line: 20
Column: 13
def check_node(self):
# Drop the STREAM-START event.
if self.check_event(StreamStartEvent):
self.get_event()
# If there are more documents available?
return not self.check_event(StreamEndEvent)
def get_node(self):
Reported by Pylint.
Line: 23
Column: 37
self.get_event()
# If there are more documents available?
return not self.check_event(StreamEndEvent)
def get_node(self):
# Get the root node of the next document.
if not self.check_event(StreamEndEvent):
return self.compose_document()
Reported by Pylint.
Line: 23
Column: 20
self.get_event()
# If there are more documents available?
return not self.check_event(StreamEndEvent)
def get_node(self):
# Get the root node of the next document.
if not self.check_event(StreamEndEvent):
return self.compose_document()
Reported by Pylint.
Line: 27
Column: 16
def get_node(self):
# Get the root node of the next document.
if not self.check_event(StreamEndEvent):
return self.compose_document()
def get_single_node(self):
# Drop the STREAM-START event.
self.get_event()
Reported by Pylint.
Line: 27
Column: 33
def get_node(self):
# Get the root node of the next document.
if not self.check_event(StreamEndEvent):
return self.compose_document()
def get_single_node(self):
# Drop the STREAM-START event.
self.get_event()
Reported by Pylint.
collectors/python.d.plugin/python_modules/pyyaml3/composer.py
65 issues
Line: 5
Column: 1
__all__ = ['Composer', 'ComposerError']
from .error import MarkedYAMLError
from .events import *
from .nodes import *
class ComposerError(MarkedYAMLError):
pass
Reported by Pylint.
Line: 6
Column: 1
__all__ = ['Composer', 'ComposerError']
from .error import MarkedYAMLError
from .events import *
from .nodes import *
class ComposerError(MarkedYAMLError):
pass
Reported by Pylint.
Line: 7
Column: 1
from .error import MarkedYAMLError
from .events import *
from .nodes import *
class ComposerError(MarkedYAMLError):
pass
class Composer:
Reported by Pylint.
Line: 19
Column: 29
def check_node(self):
# Drop the STREAM-START event.
if self.check_event(StreamStartEvent):
self.get_event()
# If there are more documents available?
return not self.check_event(StreamEndEvent)
Reported by Pylint.
Line: 19
Column: 12
def check_node(self):
# Drop the STREAM-START event.
if self.check_event(StreamStartEvent):
self.get_event()
# If there are more documents available?
return not self.check_event(StreamEndEvent)
Reported by Pylint.
Line: 20
Column: 13
def check_node(self):
# Drop the STREAM-START event.
if self.check_event(StreamStartEvent):
self.get_event()
# If there are more documents available?
return not self.check_event(StreamEndEvent)
def get_node(self):
Reported by Pylint.
Line: 23
Column: 37
self.get_event()
# If there are more documents available?
return not self.check_event(StreamEndEvent)
def get_node(self):
# Get the root node of the next document.
if not self.check_event(StreamEndEvent):
return self.compose_document()
Reported by Pylint.
Line: 23
Column: 20
self.get_event()
# If there are more documents available?
return not self.check_event(StreamEndEvent)
def get_node(self):
# Get the root node of the next document.
if not self.check_event(StreamEndEvent):
return self.compose_document()
Reported by Pylint.
Line: 27
Column: 16
def get_node(self):
# Get the root node of the next document.
if not self.check_event(StreamEndEvent):
return self.compose_document()
def get_single_node(self):
# Drop the STREAM-START event.
self.get_event()
Reported by Pylint.
Line: 27
Column: 33
def get_node(self):
# Get the root node of the next document.
if not self.check_event(StreamEndEvent):
return self.compose_document()
def get_single_node(self):
# Drop the STREAM-START event.
self.get_event()
Reported by Pylint.
collectors/python.d.plugin/python_modules/pyyaml3/representer.py
65 issues
Line: 6
Column: 1
__all__ = ['BaseRepresenter', 'SafeRepresenter', 'Representer',
'RepresenterError']
from .error import *
from .nodes import *
import datetime, sys, copyreg, types, base64
class RepresenterError(YAMLError):
Reported by Pylint.
Line: 7
Column: 1
'RepresenterError']
from .error import *
from .nodes import *
import datetime, sys, copyreg, types, base64
class RepresenterError(YAMLError):
pass
Reported by Pylint.
Line: 11
Column: 24
import datetime, sys, copyreg, types, base64
class RepresenterError(YAMLError):
pass
class BaseRepresenter:
yaml_representers = {}
Reported by Pylint.
Line: 28
Column: 9
def represent(self, data):
node = self.represent_data(data)
self.serialize(node)
self.represented_objects = {}
self.object_keeper = []
self.alias_key = None
def represent_data(self, data):
Reported by Pylint.
Line: 60
Column: 28
elif None in self.yaml_representers:
node = self.yaml_representers[None](self, data)
else:
node = ScalarNode(None, str(data))
#if alias_key is not None:
# self.represented_objects[alias_key] = node
return node
@classmethod
Reported by Pylint.
Line: 80
Column: 16
def represent_scalar(self, tag, value, style=None):
if style is None:
style = self.default_style
node = ScalarNode(tag, value, style=style)
if self.alias_key is not None:
self.represented_objects[self.alias_key] = node
return node
def represent_sequence(self, tag, sequence, flow_style=None):
Reported by Pylint.
Line: 87
Column: 16
def represent_sequence(self, tag, sequence, flow_style=None):
value = []
node = SequenceNode(tag, value, flow_style=flow_style)
if self.alias_key is not None:
self.represented_objects[self.alias_key] = node
best_style = True
for item in sequence:
node_item = self.represent_data(item)
Reported by Pylint.
Line: 93
Column: 43
best_style = True
for item in sequence:
node_item = self.represent_data(item)
if not (isinstance(node_item, ScalarNode) and not node_item.style):
best_style = False
value.append(node_item)
if flow_style is None:
if self.default_flow_style is not None:
node.flow_style = self.default_flow_style
Reported by Pylint.
Line: 105
Column: 16
def represent_mapping(self, tag, mapping, flow_style=None):
value = []
node = MappingNode(tag, value, flow_style=flow_style)
if self.alias_key is not None:
self.represented_objects[self.alias_key] = node
best_style = True
if hasattr(mapping, 'items'):
mapping = list(mapping.items())
Reported by Pylint.
Line: 118
Column: 42
for item_key, item_value in mapping:
node_key = self.represent_data(item_key)
node_value = self.represent_data(item_value)
if not (isinstance(node_key, ScalarNode) and not node_key.style):
best_style = False
if not (isinstance(node_value, ScalarNode) and not node_value.style):
best_style = False
value.append((node_key, node_value))
if flow_style is None:
Reported by Pylint.
collectors/python.d.plugin/python_modules/urllib3/contrib/securetransport.py
63 issues
Line: 40
Column: 1
import threading
import weakref
from .. import util
from ._securetransport.bindings import (
Security, SecurityConst, CoreFoundation
)
from ._securetransport.low_level import (
_assert_no_error, _cert_array_from_pem, _temporary_keychain,
Reported by Pylint.
Line: 41
Column: 1
import weakref
from .. import util
from ._securetransport.bindings import (
Security, SecurityConst, CoreFoundation
)
from ._securetransport.low_level import (
_assert_no_error, _cert_array_from_pem, _temporary_keychain,
_load_client_cert_chain
Reported by Pylint.
Line: 44
Column: 1
from ._securetransport.bindings import (
Security, SecurityConst, CoreFoundation
)
from ._securetransport.low_level import (
_assert_no_error, _cert_array_from_pem, _temporary_keychain,
_load_client_cert_chain
)
try: # Platform-specific: Python 2
Reported by Pylint.
Line: 53
Column: 5
from socket import _fileobject
except ImportError: # Platform-specific: Python 3
_fileobject = None
from ..packages.backports.makefile import backport_makefile
try:
memoryview(b'')
except NameError:
raise ImportError("SecureTransport only works on Pythons with memoryview")
Reported by Pylint.
Line: 134
Column: 26
}
if hasattr(ssl, "PROTOCOL_SSLv2"):
_protocol_to_min_max[ssl.PROTOCOL_SSLv2] = (
SecurityConst.kSSLProtocol2, SecurityConst.kSSLProtocol2
)
if hasattr(ssl, "PROTOCOL_SSLv3"):
_protocol_to_min_max[ssl.PROTOCOL_SSLv3] = (
SecurityConst.kSSLProtocol3, SecurityConst.kSSLProtocol3
Reported by Pylint.
Line: 138
Column: 26
SecurityConst.kSSLProtocol2, SecurityConst.kSSLProtocol2
)
if hasattr(ssl, "PROTOCOL_SSLv3"):
_protocol_to_min_max[ssl.PROTOCOL_SSLv3] = (
SecurityConst.kSSLProtocol3, SecurityConst.kSSLProtocol3
)
if hasattr(ssl, "PROTOCOL_TLSv1"):
_protocol_to_min_max[ssl.PROTOCOL_TLSv1] = (
SecurityConst.kTLSProtocol1, SecurityConst.kTLSProtocol1
Reported by Pylint.
Line: 337
Column: 13
if self._exception is not None:
exception, self._exception = self._exception, None
self.close()
raise exception
def _set_ciphers(self):
"""
Sets up the allowed ciphers. By default this matches the set in
util.ssl_.DEFAULT_CIPHERS, at least as supported by macOS. This is done
Reported by Pylint.
Line: 58
Column: 5
try:
memoryview(b'')
except NameError:
raise ImportError("SecureTransport only works on Pythons with memoryview")
__all__ = ['inject_into_urllib3', 'extract_from_urllib3']
# SNI always works
HAS_SNI = True
Reported by Pylint.
Line: 230
Column: 12
return SecurityConst.errSSLWouldBlock
return 0
except Exception as e:
if wrapped_socket is not None:
wrapped_socket._exception = e
return SecurityConst.errSSLInternal
Reported by Pylint.
Line: 232
Column: 13
return 0
except Exception as e:
if wrapped_socket is not None:
wrapped_socket._exception = e
return SecurityConst.errSSLInternal
def _write_callback(connection_id, data_buffer, data_length_pointer):
"""
Reported by Pylint.
collectors/python.d.plugin/mongodb/mongodb.chart.py
62 issues
Line: 20
Column: 1
except ImportError:
PYMONGO = False
from bases.FrameworkServices.SimpleService import SimpleService
REPL_SET_STATES = [
('1', 'primary'),
('8', 'down'),
('2', 'secondary'),
Reported by Pylint.
Line: 653
Column: 24
return None
data = dict()
serverStatus = raw_data['serverStatus']
dbStats = raw_data.get('dbStats')
replSetGetStatus = raw_data.get('replSetGetStatus')
getReplicationInfo = raw_data.get('getReplicationInfo')
utc_now = datetime.utcnow()
Reported by Pylint.
Line: 470
Column: 13
self.error('Type: %s, error: %s' % (str(exc_info()[0]), str(exc_info()[1])))
return False
if isinstance(data, dict) and data:
self._data_from_check = data
self.create_charts_(server_status)
return True
self.error('_get_data() returned no data or type is not <dict>')
return False
Reported by Pylint.
Line: 548
Column: 40
def create_state_lines(states):
lines = list()
for state, description in states:
dim_id = '_'.join([host, 'state', state])
lines.append([dim_id, description, 'absolute', 1, 1])
return lines
all_hosts = server_status['repl']['hosts'] + server_status['repl'].get('arbiters', list())
this_host = server_status['repl']['me']
Reported by Pylint.
Line: 668
Column: 48
except KeyError:
break
if not isinstance(value, dict) and key:
data[new_name or key] = value if not func else func(value)
if 'mapped' in serverStatus['mem']:
data['nonmapped'] = data['virtual'] - serverStatus['mem'].get('mappedWithJournal', data['mapped'])
Reported by Pylint.
Line: 669
Column: 34
break
if not isinstance(value, dict) and key:
data[new_name or key] = value if not func else func(value)
if 'mapped' in serverStatus['mem']:
data['nonmapped'] = data['virtual'] - serverStatus['mem'].get('mappedWithJournal', data['mapped'])
if data.get('maximum bytes configured'):
Reported by Pylint.
Line: 1
Column: 1
# -*- coding: utf-8 -*-
# Description: mongodb netdata python.d module
# Author: ilyam8
# SPDX-License-Identifier: GPL-3.0-or-later
import ssl
from copy import deepcopy
from datetime import datetime
Reported by Pylint.
Line: 37
Column: 1
]
def multiply_by_100(value):
return value * 100
DEFAULT_METRICS = [
('opcounters.delete', None, None),
Reported by Pylint.
Line: 217
Column: 1
]
},
'background_flush_average': {
'options': [None, 'Average time taken by flushes to execute', 'milliseconds', 'database performance',
'mongodb.background_flush_average', 'line'],
'lines': [
['average_ms', 'time', 'absolute', 1, 100]
]
},
Reported by Pylint.
Line: 224
Column: 1
]
},
'background_flush_last': {
'options': [None, 'Time taken by the last flush operation to execute', 'milliseconds', 'database performance',
'mongodb.background_flush_last', 'line'],
'lines': [
['last_ms', 'time', 'absolute', 1, 100]
]
},
Reported by Pylint.
collectors/python.d.plugin/python_modules/pyyaml3/__init__.py
61 issues
Line: 3
Column: 1
# SPDX-License-Identifier: MIT
from .error import *
from .tokens import *
from .events import *
from .nodes import *
from .loader import *
Reported by Pylint.
Line: 5
Column: 1
from .error import *
from .tokens import *
from .events import *
from .nodes import *
from .loader import *
from .dumper import *
Reported by Pylint.
Line: 6
Column: 1
from .error import *
from .tokens import *
from .events import *
from .nodes import *
from .loader import *
from .dumper import *
Reported by Pylint.
Line: 7
Column: 1
from .tokens import *
from .events import *
from .nodes import *
from .loader import *
from .dumper import *
__version__ = '3.11'
Reported by Pylint.
Line: 9
Column: 1
from .events import *
from .nodes import *
from .loader import *
from .dumper import *
__version__ = '3.11'
try:
from .cyaml import *
Reported by Pylint.
Line: 10
Column: 1
from .nodes import *
from .loader import *
from .dumper import *
__version__ = '3.11'
try:
from .cyaml import *
__with_libyaml__ = True
Reported by Pylint.
Line: 21
Column: 25
import io
def scan(stream, Loader=Loader):
"""
Scan a YAML stream and produce scanning tokens.
"""
loader = Loader(stream)
try:
Reported by Pylint.
Line: 32
Column: 26
finally:
loader.dispose()
def parse(stream, Loader=Loader):
"""
Parse a YAML stream and produce parsing events.
"""
loader = Loader(stream)
try:
Reported by Pylint.
Line: 43
Column: 28
finally:
loader.dispose()
def compose(stream, Loader=Loader):
"""
Parse the first YAML document in a stream
and produce the corresponding representation tree.
"""
loader = Loader(stream)
Reported by Pylint.
Line: 54
Column: 32
finally:
loader.dispose()
def compose_all(stream, Loader=Loader):
"""
Parse all YAML documents in a stream
and produce corresponding representation trees.
"""
loader = Loader(stream)
Reported by Pylint.
collectors/python.d.plugin/python_modules/third_party/boinc_client.py
61 issues
Line: 82
Suggestion:
https://bandit.readthedocs.io/en/latest/blacklists/blacklist_calls.html#b313-b320-xml-bad-elementtree
self.connect(*self.sockargs)
if not isinstance(request, ElementTree.Element):
request = ElementTree.fromstring(request)
# pack request
end = '\003'
if sys.version_info[0] < 3:
req = "<boinc_gui_rpc_request>\n{0}\n</boinc_gui_rpc_request>\n{1}".format(ElementTree.tostring(request).replace(' />', '/>'), end)
Reported by Bandit.
Line: 93
Column: 9
try:
self.sock.sendall(req)
except (socket.error, socket.herror, socket.gaierror, socket.timeout):
raise
req = ""
while True:
try:
Reported by Pylint.
Line: 104
Column: 13
raise socket.error("No data from socket")
if sys.version_info[0] >= 3:
buf = buf.decode()
except socket.error:
raise
n = buf.find(end)
if not n == -1: break
req += buf
req += buf[:n]
Reported by Pylint.
Line: 117
Suggestion:
https://bandit.readthedocs.io/en/latest/blacklists/blacklist_calls.html#b313-b320-xml-bad-elementtree
if text_output:
return req
else:
return ElementTree.fromstring(req)
def setattrs_from_xml(obj, xml, attrfuncdict={}):
''' Helper to set values for attributes of a class instance by mapping
matching tags from a XML file.
attrfuncdict is a dict of functions to customize value data type of
Reported by Bandit.
Line: 119
Column: 1
else:
return ElementTree.fromstring(req)
def setattrs_from_xml(obj, xml, attrfuncdict={}):
''' Helper to set values for attributes of a class instance by mapping
matching tags from a XML file.
attrfuncdict is a dict of functions to customize value data type of
each attribute. It falls back to simple int/float/bool/str detection
based on values defined in __init__(). This would not be needed if
Reported by Pylint.
Line: 128
Suggestion:
https://bandit.readthedocs.io/en/latest/blacklists/blacklist_calls.html#b313-b320-xml-bad-elementtree
Boinc used standard RPC protocol, which includes data type in XML.
'''
if not isinstance(xml, ElementTree.Element):
xml = ElementTree.fromstring(xml)
for e in list(xml):
if hasattr(obj, e.tag):
attr = getattr(obj, e.tag)
attrfunc = attrfuncdict.get(e.tag, None)
if attrfunc is None:
Reported by Bandit.
Line: 301
Column: 5
return NotImplemented
return self._tuple > other._tuple
def __str__(self):
return "{0}.{1}.{2}".format(self.major, self.minor, self.release)
def __repr__(self):
return "{0}{1}".format(self.__class__.__name__, self._tuple)
Reported by Pylint.
Line: 391
Suggestion:
https://bandit.readthedocs.io/en/latest/blacklists/blacklist_calls.html#b313-b320-xml-bad-elementtree
@classmethod
def parse(cls, xml):
if not isinstance(xml, ElementTree.Element):
xml = ElementTree.fromstring(xml)
# parse main XML
result = super(Result, cls).parse(xml)
# parse '<active_task>' children
Reported by Bandit.
Line: 416
Column: 5
return result
def __str__(self):
buf = '{0}:\n'.format(self.__class__.__name__)
for attr in self.__dict__:
value = getattr(self, attr)
if attr in ['received_time', 'report_deadline']:
value = time.ctime(value)
Reported by Pylint.
Line: 470
Suggestion:
https://bandit.readthedocs.io/en/latest/blacklists/blacklist_calls.html#b303-md5
if password is None and not self.hostname:
password = read_gui_rpc_password() or ""
nonce = self.rpc.call('<auth1/>').text
authhash = hashlib.md5('{0}{1}'.format(nonce, password).encode()).hexdigest().lower()
reply = self.rpc.call('<auth2><nonce_hash>{0}</nonce_hash></auth2>'.format(authhash))
if reply.tag == 'authorized':
return True
else:
Reported by Bandit.
collectors/python.d.plugin/megacli/megacli.chart.py
58 issues
Line: 9
Column: 1
import re
from bases.FrameworkServices.ExecutableService import ExecutableService
from bases.collection import find_binary
disabled_by_default = True
update_every = 5
Reported by Pylint.
Line: 10
Column: 1
import re
from bases.FrameworkServices.ExecutableService import ExecutableService
from bases.collection import find_binary
disabled_by_default = True
update_every = 5
Reported by Pylint.
Line: 161
Column: 3
}
# TODO: hardcoded sudo...
class Megacli:
def __init__(self):
self.s = find_binary('sudo')
self.m = find_binary('megacli') or find_binary('MegaCli') # Binary on FreeBSD is MegaCli
self.sudo_check = [self.s, '-n', '-l']
Reported by Pylint.
Line: 1
Column: 1
# -*- coding: utf-8 -*-
# Description: megacli netdata python.d module
# Author: Ilya Mashchenko (ilyam8)
# SPDX-License-Identifier: GPL-3.0-or-later
import re
from bases.FrameworkServices.ExecutableService import ExecutableService
Reported by Pylint.
Line: 12
Column: 1
from bases.FrameworkServices.ExecutableService import ExecutableService
from bases.collection import find_binary
disabled_by_default = True
update_every = 5
def adapter_charts(ads):
Reported by Pylint.
Line: 14
Column: 1
disabled_by_default = True
update_every = 5
def adapter_charts(ads):
order = [
'adapter_degraded',
Reported by Pylint.
Line: 17
Column: 1
update_every = 5
def adapter_charts(ads):
order = [
'adapter_degraded',
]
def dims(ad):
Reported by Pylint.
Line: 22
Column: 5
'adapter_degraded',
]
def dims(ad):
return [['adapter_{0}_degraded'.format(a.id), 'adapter {0}'.format(a.id)] for a in ad]
charts = {
'adapter_degraded': {
'options': [None, 'Adapter State', 'is degraded', 'adapter', 'megacli.adapter_degraded', 'line'],
Reported by Pylint.
Line: 27
Column: 1
charts = {
'adapter_degraded': {
'options': [None, 'Adapter State', 'is degraded', 'adapter', 'megacli.adapter_degraded', 'line'],
'lines': dims(ads)
},
}
return order, charts
Reported by Pylint.
Line: 35
Column: 1
return order, charts
def pd_charts(pds):
order = [
'pd_media_error',
'pd_predictive_failure',
]
Reported by Pylint.
collectors/apps.plugin/apps_plugin.c
57 issues
Line: 2134
Column: 21
CWE codes:
362
20
Suggestion:
Reconsider approach
}
file_counter++;
ssize_t l = readlink(p->fds[fdid].filename, linkname, FILENAME_MAX);
if(unlikely(l == -1)) {
// cannot read the link
if(debug_enabled || (p->target && p->target->debug_enabled))
error("Cannot read link %s", p->fds[fdid].filename);
Reported by FlawFinder.
Line: 51
Column: 5
CWE codes:
134
Suggestion:
Use a constant for the format specification
fprintf( stderr, "apps.plugin: ");
va_start( args, fmt );
vfprintf( stderr, fmt, args );
va_end( args );
fputc('\n', stderr);
}
Reported by FlawFinder.
Line: 2011
Column: 21
CWE codes:
120
Suggestion:
Use sprintf_s, snprintf, or vsnprintf
sprintf(fdsname, "other: inode: %lu", fds->kf_un.kf_file.kf_file_fileid);
break;
}
sprintf(fdsname, "%s", fds->kf_path);
break;
case KF_TYPE_SOCKET:
switch (fds->kf_sock_domain) {
case AF_INET:
case AF_INET6:
Reported by FlawFinder.
Line: 2029
Column: 29
CWE codes:
120
Suggestion:
Use sprintf_s, snprintf, or vsnprintf
default:
/* print protocol number and socket address */
#if __FreeBSD_version < 1200031
sprintf(fdsname, "socket: other: %d %s %s", fds->kf_sock_protocol, fds->kf_sa_local.__ss_pad1, fds->kf_sa_local.__ss_pad2);
#else
sprintf(fdsname, "socket: other: %d %s %s", fds->kf_sock_protocol, fds->kf_un.kf_sock.kf_sa_local.__ss_pad1, fds->kf_un.kf_sock.kf_sa_local.__ss_pad2);
#endif
}
break;
Reported by FlawFinder.
Line: 2031
Column: 29
CWE codes:
120
Suggestion:
Use sprintf_s, snprintf, or vsnprintf
#if __FreeBSD_version < 1200031
sprintf(fdsname, "socket: other: %d %s %s", fds->kf_sock_protocol, fds->kf_sa_local.__ss_pad1, fds->kf_sa_local.__ss_pad2);
#else
sprintf(fdsname, "socket: other: %d %s %s", fds->kf_sock_protocol, fds->kf_un.kf_sock.kf_sa_local.__ss_pad1, fds->kf_un.kf_sock.kf_sa_local.__ss_pad2);
#endif
}
break;
case KF_TYPE_PIPE:
sprintf(fdsname, "pipe: %lu %lu", fds->kf_un.kf_pipe.kf_pipe_addr, fds->kf_un.kf_pipe.kf_pipe_peer);
Reported by FlawFinder.
Line: 2046
Column: 21
CWE codes:
120
Suggestion:
Use sprintf_s, snprintf, or vsnprintf
#endif
break;
case KF_TYPE_SHM:
sprintf(fdsname, "other: shm: %s size: %lu", fds->kf_path, fds->kf_un.kf_file.kf_file_size);
break;
case KF_TYPE_SEM:
sprintf(fdsname, "other: sem: %u", fds->kf_un.kf_sem.kf_sem_value);
break;
default:
Reported by FlawFinder.
Line: 2229
Column: 20
CWE codes:
134
Suggestion:
Use a constant for the format specification
, p->stat_collected_usec - time
);
if(p->utime) fprintf(stderr, " utime=" KERNEL_UINT_FORMAT, p->utime);
if(p->stime) fprintf(stderr, " stime=" KERNEL_UINT_FORMAT, p->stime);
if(p->gtime) fprintf(stderr, " gtime=" KERNEL_UINT_FORMAT, p->gtime);
if(p->cutime) fprintf(stderr, " cutime=" KERNEL_UINT_FORMAT, p->cutime);
if(p->cstime) fprintf(stderr, " cstime=" KERNEL_UINT_FORMAT, p->cstime);
if(p->cgtime) fprintf(stderr, " cgtime=" KERNEL_UINT_FORMAT, p->cgtime);
Reported by FlawFinder.
Line: 2230
Column: 20
CWE codes:
134
Suggestion:
Use a constant for the format specification
);
if(p->utime) fprintf(stderr, " utime=" KERNEL_UINT_FORMAT, p->utime);
if(p->stime) fprintf(stderr, " stime=" KERNEL_UINT_FORMAT, p->stime);
if(p->gtime) fprintf(stderr, " gtime=" KERNEL_UINT_FORMAT, p->gtime);
if(p->cutime) fprintf(stderr, " cutime=" KERNEL_UINT_FORMAT, p->cutime);
if(p->cstime) fprintf(stderr, " cstime=" KERNEL_UINT_FORMAT, p->cstime);
if(p->cgtime) fprintf(stderr, " cgtime=" KERNEL_UINT_FORMAT, p->cgtime);
if(p->minflt) fprintf(stderr, " minflt=" KERNEL_UINT_FORMAT, p->minflt);
Reported by FlawFinder.
Line: 2231
Column: 20
CWE codes:
134
Suggestion:
Use a constant for the format specification
if(p->utime) fprintf(stderr, " utime=" KERNEL_UINT_FORMAT, p->utime);
if(p->stime) fprintf(stderr, " stime=" KERNEL_UINT_FORMAT, p->stime);
if(p->gtime) fprintf(stderr, " gtime=" KERNEL_UINT_FORMAT, p->gtime);
if(p->cutime) fprintf(stderr, " cutime=" KERNEL_UINT_FORMAT, p->cutime);
if(p->cstime) fprintf(stderr, " cstime=" KERNEL_UINT_FORMAT, p->cstime);
if(p->cgtime) fprintf(stderr, " cgtime=" KERNEL_UINT_FORMAT, p->cgtime);
if(p->minflt) fprintf(stderr, " minflt=" KERNEL_UINT_FORMAT, p->minflt);
if(p->cminflt) fprintf(stderr, " cminflt=" KERNEL_UINT_FORMAT, p->cminflt);
Reported by FlawFinder.
Line: 2232
Column: 20
CWE codes:
134
Suggestion:
Use a constant for the format specification
if(p->utime) fprintf(stderr, " utime=" KERNEL_UINT_FORMAT, p->utime);
if(p->stime) fprintf(stderr, " stime=" KERNEL_UINT_FORMAT, p->stime);
if(p->gtime) fprintf(stderr, " gtime=" KERNEL_UINT_FORMAT, p->gtime);
if(p->cutime) fprintf(stderr, " cutime=" KERNEL_UINT_FORMAT, p->cutime);
if(p->cstime) fprintf(stderr, " cstime=" KERNEL_UINT_FORMAT, p->cstime);
if(p->cgtime) fprintf(stderr, " cgtime=" KERNEL_UINT_FORMAT, p->cgtime);
if(p->minflt) fprintf(stderr, " minflt=" KERNEL_UINT_FORMAT, p->minflt);
if(p->cminflt) fprintf(stderr, " cminflt=" KERNEL_UINT_FORMAT, p->cminflt);
if(p->majflt) fprintf(stderr, " majflt=" KERNEL_UINT_FORMAT, p->majflt);
Reported by FlawFinder.
collectors/python.d.plugin/python_modules/pyyaml2/serializer.py
57 issues
Line: 5
Column: 1
__all__ = ['Serializer', 'SerializerError']
from error import YAMLError
from events import *
from nodes import *
class SerializerError(YAMLError):
pass
Reported by Pylint.
Line: 6
Column: 1
__all__ = ['Serializer', 'SerializerError']
from error import YAMLError
from events import *
from nodes import *
class SerializerError(YAMLError):
pass
Reported by Pylint.
Line: 7
Column: 1
from error import YAMLError
from events import *
from nodes import *
class SerializerError(YAMLError):
pass
class Serializer(object):
Reported by Pylint.
Line: 30
Column: 23
def open(self):
if self.closed is None:
self.emit(StreamStartEvent(encoding=self.use_encoding))
self.closed = False
elif self.closed:
raise SerializerError("serializer is closed")
else:
raise SerializerError("serializer is already opened")
Reported by Pylint.
Line: 30
Column: 13
def open(self):
if self.closed is None:
self.emit(StreamStartEvent(encoding=self.use_encoding))
self.closed = False
elif self.closed:
raise SerializerError("serializer is closed")
else:
raise SerializerError("serializer is already opened")
Reported by Pylint.
Line: 41
Column: 23
if self.closed is None:
raise SerializerError("serializer is not opened")
elif not self.closed:
self.emit(StreamEndEvent())
self.closed = True
#def __del__(self):
# self.close()
Reported by Pylint.
Line: 41
Column: 13
if self.closed is None:
raise SerializerError("serializer is not opened")
elif not self.closed:
self.emit(StreamEndEvent())
self.closed = True
#def __del__(self):
# self.close()
Reported by Pylint.
Line: 52
Column: 19
raise SerializerError("serializer is not opened")
elif self.closed:
raise SerializerError("serializer is closed")
self.emit(DocumentStartEvent(explicit=self.use_explicit_start,
version=self.use_version, tags=self.use_tags))
self.anchor_node(node)
self.serialize_node(node, None, None)
self.emit(DocumentEndEvent(explicit=self.use_explicit_end))
self.serialized_nodes = {}
Reported by Pylint.
Line: 52
Column: 9
raise SerializerError("serializer is not opened")
elif self.closed:
raise SerializerError("serializer is closed")
self.emit(DocumentStartEvent(explicit=self.use_explicit_start,
version=self.use_version, tags=self.use_tags))
self.anchor_node(node)
self.serialize_node(node, None, None)
self.emit(DocumentEndEvent(explicit=self.use_explicit_end))
self.serialized_nodes = {}
Reported by Pylint.
Line: 56
Column: 9
version=self.use_version, tags=self.use_tags))
self.anchor_node(node)
self.serialize_node(node, None, None)
self.emit(DocumentEndEvent(explicit=self.use_explicit_end))
self.serialized_nodes = {}
self.anchors = {}
self.last_anchor_id = 0
def anchor_node(self, node):
Reported by Pylint.