diff options
author | Emilio Pozuelo Monfort <pochu@debian.org> | 2023-04-28 14:34:35 +0200 |
---|---|---|
committer | Emilio Pozuelo Monfort <pochu@debian.org> | 2023-04-28 14:34:35 +0200 |
commit | 0dad6284780e265549d2b69f06c17be794a2d9de (patch) | |
tree | 9a0fa661af05db4b843041a22cd15a3553255eb0 /bin | |
parent | 68c7d91c00b8ef29a462409c20d457469802f111 (diff) |
process-cve-records: improve description parsing
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/process-cve-records | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/bin/process-cve-records b/bin/process-cve-records index 7cf9d2605c..a5d074655d 100755 --- a/bin/process-cve-records +++ b/bin/process-cve-records @@ -67,10 +67,19 @@ def parse_record(record, cve): if desc['lang'].startswith('en')] if desc: desc = desc[0] - if desc and len(desc) > 70: + # for some reason descriptions may contain new lines desc = desc.replace('\n', ' ') - desc = desc[:70] + ' ...' + + # and even non-printable characters such as \xa0 ( ) + desc = "".join([ c for c in desc if c.isprintable() ]) + + # and some contain leading spaces + desc = desc.strip() + + if len(desc) > 70: + desc = desc[:70] + ' ...' + cve.header.description = f"({desc})" if not is_reserved(record) and not is_rejected(record) \ |