summaryrefslogtreecommitdiffstats
path: root/src/file_sig.c
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2011-04-19 08:24:20 +0200
committerChristophe Grenier <grenier@cgsecurity.org>2011-04-19 08:24:20 +0200
commit95bc549bb15221c86c6e2693018970b2436bb2e0 (patch)
treead800af7f8857d310893b5374faa025f8cfa200b /src/file_sig.c
parent505020622327ea30d790d8bbe539d1697b5ac331 (diff)
PhotoRec: fix for custom signature using hexa
Diffstat (limited to 'src/file_sig.c')
-rw-r--r--src/file_sig.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/file_sig.c b/src/file_sig.c
index 6c8681a..c843e3b 100644
--- a/src/file_sig.c
+++ b/src/file_sig.c
@@ -166,9 +166,9 @@ static char *str_uint(char *src, unsigned int *resptr)
if(*src>='0' && *src<='9')
res=res*16+(*src)-'0';
else if(*src>='A' && *src<='F')
- res=res*16+(*src)-'A';
+ res=res*16+(*src)-'A'+10;
else if(*src>='a' && *src<='f')
- res=res*16+(*src)-'a';
+ res=res*16+(*src)-'a'+10;
else
{
*resptr=res;
@@ -310,18 +310,18 @@ static char *parse_signature_file(file_stat_t *file_stat, char *pos)
if(*pos>='0' && *pos<='9')
val-='0';
else if(*pos>='A' && *pos<='F')
- val-='A';
+ val=val-'A'+10;
else if(*pos>='a' && *pos<='f')
- val-='a';
+ val=val-'a'+10;
pos++;
val*=16;
val+=(*pos);
if(*pos>='0' && *pos<='9')
val-='0';
else if(*pos>='A' && *pos<='F')
- val-='A';
+ val=val-'A'+10;
else if(*pos>='a' && *pos<='f')
- val-='a';
+ val=val-'a'+10;
pos++;
tmp[signature_size++]=val;
}