diff options
author | Konstantin Ryabitsev <konstantin@linuxfoundation.org> | 2021-08-03 10:58:02 -0400 |
---|---|---|
committer | Konstantin Ryabitsev <konstantin@linuxfoundation.org> | 2021-08-03 11:00:26 -0400 |
commit | d0e8fa3bb2475187fbf9fcfe73c38ec83ad7e6b5 (patch) | |
tree | 626d5bce954d1cb10d766855ffd82cb96ef45e42 | |
parent | 06cc7c8820aea85d1329911b785d7bf4ecaacb1f (diff) | |
download | b4-d0e8fa3bb2475187fbf9fcfe73c38ec83ad7e6b5.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
@@ -656,7 +656,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): |