summaryrefslogtreecommitdiff
path: root/fail2ban/helpers.py
diff options
context:
space:
mode:
authorsebres <serg.brester@sebres.de>2019-12-12 21:41:49 +0100
committersebres <serg.brester@sebres.de>2019-12-12 21:45:09 +0100
commit7e98073014bba7a7a46edc530112b08534c15813 (patch)
tree8ab2ab0227d1bc0db12dac97c7e532b8c310cca5 /fail2ban/helpers.py
parentf3dbc9dda10e52610e3de26f538b5581fd905505 (diff)
downloadfail2ban-7e98073014bba7a7a46edc530112b08534c15813.tar.gz
amend to f3dbc9dda10e52610e3de26f538b5581fd905505: don't need truncate (if the name with \0 exceeds 16 bytes, the string is silently truncated by prctl).
Diffstat (limited to 'fail2ban/helpers.py')
-rw-r--r--fail2ban/helpers.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/fail2ban/helpers.py b/fail2ban/helpers.py
index 8d981ed6..44574ff8 100644
--- a/fail2ban/helpers.py
+++ b/fail2ban/helpers.py
@@ -461,14 +461,16 @@ def substituteRecursiveTags(inptags, conditional='',
if _libcap:
def prctl_set_th_name(name):
"""Helper to set real thread name (used for identification and diagnostic purposes).
+
+ Side effect: name can be silently truncated to 15 bytes (16 bytes with NTS zero)
"""
try:
if sys.version_info >= (3,): # pragma: 2.x no cover
name = name.encode()
else: # pragma: 3.x no cover
name = bytes(name)
- _libcap.prctl(15, name[0:15]) # PR_SET_NAME = 15, name can be up to 15 bytes long (16 bytes with NTS zero)
- except:
+ _libcap.prctl(15, name) # PR_SET_NAME = 15
+ except: # pragma: no cover
pass
else: # pragma: no cover
def prctl_set_th_name(name):