aboutsummaryrefslogtreecommitdiffstats
path: root/lib/rc4.c
diff options
context:
space:
mode:
authorWilmer van der Gaast <wilmer@gaast.net>2006-06-25 19:23:27 +0200
committerWilmer van der Gaast <wilmer@gaast.net>2006-06-25 19:23:27 +0200
commit88086dbd9002123be39d00c53460f1ec9f2b719a (patch)
tree2370e9c8b59040b16217e120f203d24ff34f9270 /lib/rc4.c
parent6e1fed7057ee26f21b0e59a5aeb292d4f3f0e8ae (diff)
Added versioning information to the XML-file (convenient for later format
changes), got rid of confusing "Password successfully changed" message when the user uses the identify-command and protected rc4_decode() against short inputs.
Diffstat (limited to 'lib/rc4.c')
-rw-r--r--lib/rc4.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/rc4.c b/lib/rc4.c
index 2b732ba2..cbe0e2c0 100644
--- a/lib/rc4.c
+++ b/lib/rc4.c
@@ -157,6 +157,12 @@ int rc4_decode( unsigned char *crypt, int crypt_len, unsigned char **clear, char
key_len = strlen( password ) + RC4_IV_LEN;
clear_len = crypt_len - RC4_IV_LEN;
+ if( clear_len < 0 )
+ {
+ *clear = g_strdup( "" );
+ return 0;
+ }
+
/* Prepare buffers and the key + IV */
*clear = g_malloc( clear_len + 1 );
key = g_malloc( key_len );