From f9ee529a7268770c6a6e2b1ff9965821f434c67b Mon Sep 17 00:00:00 2001 From: robi Date: Sun, 12 Dec 2010 19:40:34 +0000 Subject: small changes tiff() and pnm() --- src/file_type.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/file_type.c b/src/file_type.c index 74b6f48..746afd4 100644 --- a/src/file_type.c +++ b/src/file_type.c @@ -1469,7 +1469,7 @@ int file_psd(unsigned char *buf, int *size, __u32 scan , int flag, struct found_ //pnm int file_pnm(unsigned char *buf, int *size, __u32 scan , int flag, struct found_data_t* f_data){ - int x,y,d; + int x,y,d,s ; unsigned char *c, *txt; __u32 ssize = 0; int ret = 0; @@ -1499,8 +1499,16 @@ case 2: c++; txt = c + 1; while (isspace(*txt)) txt++; - if (*txt == '#'){ - while (!isspace(*txt)) txt++; + while (*txt == '#'){ + s = 0; + while ((*txt != 0x0a) && (*txt != 0x0d) && (s < 70)){ + txt++; + s++; + } + if (s == 70) { + f_data->func = file_none; + return 0; + } while (isspace(*txt)) txt++; } x=atoi(txt); @@ -1571,8 +1579,10 @@ int file_tiff(unsigned char *buf, int *size, __u32 scan , int flag, struct found case 0 : if (f_data->size ){ if ((f_data->inode->i_size > f_data->size) && (*size < (current_fs->blocksize -8))){ //FIXME - *size += 8; ret = 4; + if (*size < (current_fs->blocksize - 256)) + ret = 1; + *size += 8; } } else{ -- cgit v1.2.3