Commit 3c505247130554f616de4699ce3d3a6073c2d709
1 parent
a7938bfa
Adds an additional check to detect if DDE links exist inside fldSimple values
Showing
1 changed file
with
8 additions
and
1 deletions
oletools/msodde.py
| @@ -80,7 +80,7 @@ NS_WORD = 'http://schemas.openxmlformats.org/wordprocessingml/2006/main' | @@ -80,7 +80,7 @@ NS_WORD = 'http://schemas.openxmlformats.org/wordprocessingml/2006/main' | ||
| 80 | 80 | ||
| 81 | # XML tag for 'w:instrText' | 81 | # XML tag for 'w:instrText' |
| 82 | TAG_W_INSTRTEXT = '{%s}instrText' % NS_WORD | 82 | TAG_W_INSTRTEXT = '{%s}instrText' % NS_WORD |
| 83 | - | 83 | +TAG_W_FLDSIMPLE = '{%s}fldSimple' % NS_WORD |
| 84 | 84 | ||
| 85 | # === FUNCTIONS ============================================================== | 85 | # === FUNCTIONS ============================================================== |
| 86 | 86 | ||
| @@ -111,6 +111,13 @@ def process_file(filepath): | @@ -111,6 +111,13 @@ def process_file(filepath): | ||
| 111 | # concatenate the text of the field, if present: | 111 | # concatenate the text of the field, if present: |
| 112 | if elem.text is not None: | 112 | if elem.text is not None: |
| 113 | text += elem.text | 113 | text += elem.text |
| 114 | + | ||
| 115 | + for elem in root.iter(TAG_W_FLDSIMPLE): | ||
| 116 | + # concatenate the attribute of the field, if present: | ||
| 117 | + if elem.attrib is not None: | ||
| 118 | + text += elem.attrib['{http://schemas.openxmlformats.org/wordprocessingml/2006/main}instr'] | ||
| 119 | + | ||
| 120 | + | ||
| 114 | return text | 121 | return text |
| 115 | 122 | ||
| 116 | 123 |