Commit 7a1430865e3a5edf8baec7ea7faba5819730f5f2

Authored by Christian Herdtweck
1 parent 8f55b649

msodde: combine dde links as late as possible to single string

Showing 1 changed file with 5 additions and 4 deletions
oletools/msodde.py
... ... @@ -285,8 +285,7 @@ def process_ole_stream(stream):
285 285 log.debug('Checked {0} characters, found {1} fields'
286 286 .format(idx, len(result_parts)))
287 287  
288   - # copy behaviour of process_xml: Just concatenate unicode strings
289   - return u''.join(result_parts)
  288 + return result_parts
290 289  
291 290  
292 291 def process_ole_storage(ole):
... ... @@ -296,7 +295,7 @@ def process_ole_storage(ole):
296 295 st_type = ole.get_type(st)
297 296 if st_type == olefile.STGTY_STREAM: # a stream
298 297 stream = None
299   - links = ''
  298 + links = []
300 299 try:
301 300 stream = ole.openstream(st)
302 301 log.debug('Checking stream {0}'.format(st))
... ... @@ -307,7 +306,7 @@ def process_ole_storage(ole):
307 306 if stream:
308 307 stream.close()
309 308 if links:
310   - results.append(links)
  309 + results.extend(links)
311 310 elif st_type == olefile.STGTY_STORAGE: # a storage
312 311 log.debug('Checking storage {0}'.format(st))
313 312 links = process_ole_storage(st)
... ... @@ -331,6 +330,8 @@ def process_ole(filepath):
331 330 log.debug('process_ole')
332 331 ole = olefile.OleFileIO(filepath, path_encoding=None)
333 332 text_parts = process_ole_storage(ole)
  333 +
  334 + # mimic behaviour of process_openxml: combine links to single text string
334 335 return u'\n'.join(text_parts)
335 336  
336 337  
... ...