aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/ole2_extractor.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/ole2_extractor.c')
-rw-r--r--src/plugins/ole2_extractor.c44
1 files changed, 29 insertions, 15 deletions
diff --git a/src/plugins/ole2_extractor.c b/src/plugins/ole2_extractor.c
index 5cef88e..fa6a448 100644
--- a/src/plugins/ole2_extractor.c
+++ b/src/plugins/ole2_extractor.c
@@ -430,6 +430,8 @@ history_extract(GsfInput * stream,
430 if (gsf_input_remaining(stream) < lcbSttbSavedBy) 430 if (gsf_input_remaining(stream) < lcbSttbSavedBy)
431 return 0; 431 return 0;
432 lbuffer = malloc(lcbSttbSavedBy); 432 lbuffer = malloc(lcbSttbSavedBy);
433 if (lbuffer == NULL)
434 return 0;
433 // read all the revision history 435 // read all the revision history
434 gsf_input_read(stream, lcbSttbSavedBy, lbuffer); 436 gsf_input_read(stream, lcbSttbSavedBy, lbuffer);
435 // there are n strings, so n/2 revisions (author & file) 437 // there are n strings, so n/2 revisions (author & file)
@@ -444,29 +446,41 @@ history_extract(GsfInput * stream,
444 (where + 2 * length + 2 <= where) ) 446 (where + 2 * length + 2 <= where) )
445 break; 447 break;
446 author = EXTRACTOR_common_convert_to_utf8((const char*) &lbuffer[where], 448 author = EXTRACTOR_common_convert_to_utf8((const char*) &lbuffer[where],
447 length * 2, 449 length * 2,
448 "UTF-16BE"); 450 "UTF-16BE");
449 where += length * 2 + 1; 451 where += length * 2 + 1;
450 length = lbuffer[where++]; 452 length = lbuffer[where++];
451 if ( (where + 2 * length >= lcbSttbSavedBy) || 453 if ( (where + 2 * length >= lcbSttbSavedBy) ||
452 (where + 2 * length + 1 <= where) ) { 454 (where + 2 * length + 1 <= where) ) {
453 free(author); 455 if (author != NULL)
456 free(author);
454 break; 457 break;
455 } 458 }
456 filename = EXTRACTOR_common_convert_to_utf8((const char*) &lbuffer[where], 459 filename = EXTRACTOR_common_convert_to_utf8((const char*) &lbuffer[where],
457 length * 2, 460 length * 2,
458 "UTF-16BE"); 461 "UTF-16BE");
459 where += length * 2 + 1; 462 where += length * 2 + 1;
460 rbuf = malloc(strlen(author) + strlen(filename) + 512); 463 if ( (author != NULL) &&
461 snprintf(rbuf, 512 + strlen(author) + strlen(filename), 464 (filename != NULL) )
462 _("Revision #%u: Author '%s' worked on '%s'"), 465 {
463 i, author, filename); 466 rbuf = malloc(strlen(author) + strlen(filename) + 512);
464 free(author); 467 if (rbuf != NULL)
465 free(filename); 468 {
466 ret = addKeyword(proc, proc_cls, 469 snprintf(rbuf,
467 rbuf, 470 512 + strlen(author) + strlen(filename),
468 EXTRACTOR_METATYPE_REVISION_HISTORY); 471 _("Revision #%u: Author '%s' worked on '%s'"),
469 free(rbuf); 472 i, author, filename);
473 ret = addKeyword(proc, proc_cls,
474 rbuf,
475 EXTRACTOR_METATYPE_REVISION_HISTORY);
476 if (rbuf != NULL)
477 free(rbuf);
478 }
479 }
480 if (author != NULL)
481 free(author);
482 if (filename != NULL)
483 free(filename);
470 if (0 != ret) 484 if (0 != ret)
471 break; 485 break;
472 } 486 }