commit 1c85152c3162f22ab8ab871435ad99560c3fbb39
Author: Christophe Fergeau <[email protected]>
Date: Sun Nov 1 21:10:26 2009 +0100
fix inverted length check in string_to_hex
src/itdb_hash58.c | 4 +---
src/itdb_hash72.c | 4 +---
2 files changed, 2 insertions(+), 6 deletions(-)
---
diff --git a/src/itdb_hash58.c b/src/itdb_hash58.c
index 3d6b008..e450ef7 100644
--- a/src/itdb_hash58.c
+++ b/src/itdb_hash58.c
@@ -132,13 +132,11 @@ static int ord_from_hex_char(const char c)
static int string_to_hex(unsigned char *dest, const int array_size,
const char *s)
{
- int l;
-
/* skip optional '0x' prefix */
if (s[0] == '0' && (s[1] == 'x' || s[1] == 'X'))
s += 2;
- if ((l = strlen(s)) < array_size*2)
+ if (strlen(s) > array_size*2)
return -8;
do {
diff --git a/src/itdb_hash72.c b/src/itdb_hash72.c
index 8d925fe..ec86523 100644
--- a/src/itdb_hash72.c
+++ b/src/itdb_hash72.c
@@ -115,13 +115,11 @@ static int ord_from_hex_char(const char c)
static int string_to_hex(unsigned char *dest, const int array_size,
const char *s)
{
- int l;
-
/* skip optional '0x' prefix */
if (s[0] == '0' && (s[1] == 'x' || s[1] == 'X'))
s += 2;
- if ((l = strlen(s)) < array_size*2)
+ if (strlen(s) > array_size*2)
return -8;
do {
------------------------------------------------------------------------------
Return on Information:
Google Enterprise Search pays you back
Get the facts.
http://p.sf.net/sfu/google-dev2dev
_______________________________________________
gtkpod-cvs2 mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gtkpod-cvs2