summaryrefslogtreecommitdiffstats
path: root/src/file_txt.c
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2016-07-27 11:48:39 +0200
committerChristophe Grenier <grenier@cgsecurity.org>2016-07-27 11:48:39 +0200
commitcf544d5b956959270b967eab5bf14fed998c2d73 (patch)
tree6689331492d66e5e85e40b96fd053991b9af0ead /src/file_txt.c
parentca0e309843d0a3369fb8a6344c951ea07048cc11 (diff)
PhotoRec: recover svg file
File sample https://raw.githubusercontent.com/nbeaver/mimetype-menagerie/master/media-types/image/svg%2Bxml/Animated_pendulum.svg
Diffstat (limited to 'src/file_txt.c')
-rw-r--r--src/file_txt.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/file_txt.c b/src/file_txt.c
index 4b69a41..fa1f5ef 100644
--- a/src/file_txt.c
+++ b/src/file_txt.c
@@ -1384,6 +1384,15 @@ static int header_check_stl(const unsigned char *buffer, const unsigned int buff
return 1;
}
+static int header_check_svg(const unsigned char *buffer, const unsigned int buffer_size, const unsigned int safe_header_only, const file_recovery_t *file_recovery, file_recovery_t *file_recovery_new)
+{
+ /* Scalable Vector Graphics */
+ reset_file_recovery(file_recovery_new);
+ file_recovery_new->extension="svg";
+ file_recovery_new->file_check=&file_check_svg;
+ return 1;
+}
+
static int header_check_snz(const unsigned char *buffer, const unsigned int buffer_size, const unsigned int safe_header_only, const file_recovery_t *file_recovery, file_recovery_t *file_recovery_new)
{
const unsigned int buffer_size_test=(buffer_size < 512? buffer_size : 512);
@@ -1437,4 +1446,5 @@ static void register_header_check_fasttxt(file_stat_t *file_stat)
/* TinyTag */
register_header_check(0, "FF 09 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FFFF 00", 55, &header_check_ttd, file_stat);
register_header_check(0, "<x:xmpmeta xmlns:x=\"adobe:ns:meta/\"", 35, &header_check_xmp, file_stat);
+ register_header_check(0, "<svg xmlns=\"http://www.w3.org/2000/svg\"", 39, &header_check_svg, file_stat);
}