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,8 +285,7 @@ def process_ole_stream(stream):
285 log.debug('Checked {0} characters, found {1} fields' 285 log.debug('Checked {0} characters, found {1} fields'
286 .format(idx, len(result_parts))) 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 def process_ole_storage(ole): 291 def process_ole_storage(ole):
@@ -296,7 +295,7 @@ def process_ole_storage(ole): @@ -296,7 +295,7 @@ def process_ole_storage(ole):
296 st_type = ole.get_type(st) 295 st_type = ole.get_type(st)
297 if st_type == olefile.STGTY_STREAM: # a stream 296 if st_type == olefile.STGTY_STREAM: # a stream
298 stream = None 297 stream = None
299 - links = '' 298 + links = []
300 try: 299 try:
301 stream = ole.openstream(st) 300 stream = ole.openstream(st)
302 log.debug('Checking stream {0}'.format(st)) 301 log.debug('Checking stream {0}'.format(st))
@@ -307,7 +306,7 @@ def process_ole_storage(ole): @@ -307,7 +306,7 @@ def process_ole_storage(ole):
307 if stream: 306 if stream:
308 stream.close() 307 stream.close()
309 if links: 308 if links:
310 - results.append(links) 309 + results.extend(links)
311 elif st_type == olefile.STGTY_STORAGE: # a storage 310 elif st_type == olefile.STGTY_STORAGE: # a storage
312 log.debug('Checking storage {0}'.format(st)) 311 log.debug('Checking storage {0}'.format(st))
313 links = process_ole_storage(st) 312 links = process_ole_storage(st)
@@ -331,6 +330,8 @@ def process_ole(filepath): @@ -331,6 +330,8 @@ def process_ole(filepath):
331 log.debug('process_ole') 330 log.debug('process_ole')
332 ole = olefile.OleFileIO(filepath, path_encoding=None) 331 ole = olefile.OleFileIO(filepath, path_encoding=None)
333 text_parts = process_ole_storage(ole) 332 text_parts = process_ole_storage(ole)
  333 +
  334 + # mimic behaviour of process_openxml: combine links to single text string
334 return u'\n'.join(text_parts) 335 return u'\n'.join(text_parts)
335 336
336 337