aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2018-08-05 22:20:27 +0200
committerChristian Grothoff <christian@grothoff.org>2018-08-05 22:21:23 +0200
commit426a4feb38645fc31e3530a51eef0f683f6e61ad (patch)
tree89bfe299f9b87475b4675616e667ebeabc697983
parentfb672b7187898e4480c1b513e367a26eea429bd2 (diff)
downloadlibextractor-426a4feb38645fc31e3530a51eef0f683f6e61ad.tar.gz
libextractor-426a4feb38645fc31e3530a51eef0f683f6e61ad.zip
fix #5404
-rw-r--r--src/plugins/ole2_extractor.c45
1 files changed, 28 insertions, 17 deletions
diff --git a/src/plugins/ole2_extractor.c b/src/plugins/ole2_extractor.c
index e8e210e..878b8a4 100644
--- a/src/plugins/ole2_extractor.c
+++ b/src/plugins/ole2_extractor.c
@@ -222,24 +222,35 @@ process_metadata (gpointer key,
222 } 222 }
223 if (NULL == contents) 223 if (NULL == contents)
224 return; 224 return;
225 if (0 == strcmp (type, "meta:generator")) 225 if (0 == strcmp (type,
226 "meta:generator"))
226 { 227 {
227 const char *mimetype = "application/vnd.ms-files"; 228 const char *mimetype = "application/vnd.ms-files";
228 if ( (0 == strncmp (value, "Microsoft Word", 14)) || 229 struct {
229 (0 == strncmp (value, "Microsoft Office Word", 21))) 230 const char *v;
230 mimetype = "application/msword"; 231 const char *m;
231 else if ( (0 == strncmp(value, "Microsoft Excel", 15)) || 232 } mm[] = {
232 (0 == strncmp(value, "Microsoft Office Excel", 22)) ) 233 { "Microsoft Word", "application/msword" },
233 mimetype = "application/vnd.ms-excel"; 234 { "Microsoft Office Word", "application/msword" },
234 else if ( (0 == strncmp(value, "Microsoft PowerPoint", 20)) || 235 { "Microsoft Excel", "application/vnd.ms-excel" },
235 (0 == strncmp(value, "Microsoft Office PowerPoint", 27)) ) 236 { "Microsoft Office Excel", "application/vnd.ms-excel" },
236 mimetype = "application/vnd.ms-powerpoint"; 237 { "Microsoft PowerPoint", "application/vnd.ms-powerpoint" },
237 else if (0 == strncmp(value, "Microsoft Project", 17)) 238 { "Microsoft Office PowerPoint", "application/vnd.ms-powerpoint"},
238 mimetype = "application/vnd.ms-project"; 239 { "Microsoft Project", "application/vnd.ms-project" },
239 else if (0 == strncmp(value, "Microsoft Visio", 15)) 240 { "Microsoft Visio", "application/vnd.visio" },
240 mimetype = "application/vnd.visio"; 241 { "Microsoft Office", "application/vnd.ms-office" },
241 else if (0 == strncmp(value, "Microsoft Office", 16)) 242 { NULL, NULL }
242 mimetype = "application/vnd.ms-office"; 243 };
244 int i;
245
246 for (i=0;NULL != mm[i].v; i++)
247 if (0 == strncmp (value,
248 mm[i].v,
249 strlen (mm[i].v) + 1))
250 {
251 mimetype = mm[i].m;
252 break;
253 }
243 if (0 != add_metadata (pc->proc, 254 if (0 != add_metadata (pc->proc,
244 pc->proc_cls, 255 pc->proc_cls,
245 mimetype, 256 mimetype,
@@ -336,7 +347,7 @@ process_star_office (GsfInput *src,
336 (buf[1] != 0x0) || 347 (buf[1] != 0x0) ||
337 (0 != strncmp (&buf[2], 348 (0 != strncmp (&buf[2],
338 "SfxDocumentInfo", 349 "SfxDocumentInfo",
339 strlen ("SfxDocumentInfo"))) || 350 strlen ("SfxDocumentInfo") + 1)) ||
340 (buf[0x11] != 0x0B) || 351 (buf[0x11] != 0x0B) ||
341 (buf[0x13] != 0x00) || /* pw protected! */ 352 (buf[0x13] != 0x00) || /* pw protected! */
342 (buf[0x12] != 0x00) ) 353 (buf[0x12] != 0x00) )