diff options
author | Konstantin Ryabitsev <konstantin@linuxfoundation.org> | 2021-08-03 10:58:02 -0400 |
---|---|---|
committer | Konstantin Ryabitsev <konstantin@linuxfoundation.org> | 2021-08-03 10:58:02 -0400 |
commit | 98c758ff7b9ab1a571d278c74f4b6c38295fc83d (patch) | |
tree | a76dd3852f247c3d2632e25e42e374c86a56cbfe | |
parent | 45ef591d2fb245a06600514d8df57ab64d519fd8 (diff) | |
download | b4-98c758ff7b9ab1a571d278c74f4b6c38295fc83d.tar.gz |
Sanitize msgid before using it as savename
Before using the msgid as part of the filename, clean it up to only
contains sensible characters.
Reported-by: Rob Herring <robherring2@gmail.com>
Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
-rw-r--r-- | b4/mbox.py | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -623,7 +623,8 @@ def main(cmdargs): if cmdargs.wantname: savename = os.path.join(cmdargs.outdir, cmdargs.wantname) else: - savename = os.path.join(cmdargs.outdir, f'{msgid}.{dftext}') + safe_msgid = re.sub(r'[^\w@.+%-]+', '_', msgid).strip('_') + savename = os.path.join(cmdargs.outdir, f'{safe_msgid}.{dftext}') if save_maildir: if os.path.isdir(savename): |