Mercurial > pidgin
changeset 12765:29594d4ccbb1
[gaim-migrate @ 15112]
sf patch #1398385, from Thomas Butter
"gaim_cipher_context_digest(ctx, sizeof(response), response, NULL);
sizeof(response) is always 4 (its a pointer) and thus digest fails.
The patch also cleans up a bit in that function."
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Sun, 08 Jan 2006 20:54:57 +0000 |
parents | 657895c5f3f2 |
children | 42af52cb61f7 |
files | src/proxy.c |
diffstat | 1 files changed, 8 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/src/proxy.c Sun Jan 08 19:09:47 2006 +0000 +++ b/src/proxy.c Sun Jan 08 20:54:57 2006 +0000 @@ -1558,25 +1558,23 @@ unsigned char Kxoripad[65]; unsigned char Kxoropad[65]; int pwlen; - char * pwinput; - guchar md5buf[16]; cipher = gaim_ciphers_find_cipher("md5"); ctx = gaim_cipher_context_new(cipher, NULL); - pwinput=(char *)passwd; + memset(Kxoripad,0,sizeof(Kxoripad)); + memset(Kxoropad,0,sizeof(Kxoropad)); + pwlen=strlen(passwd); if (pwlen>64) { gaim_cipher_context_append(ctx, (const guchar *)passwd, strlen(passwd)); - gaim_cipher_context_digest(ctx, sizeof(md5buf), md5buf, NULL); - pwinput=(char *)md5buf; + gaim_cipher_context_digest(ctx, sizeof(Kxoripad), Kxoripad, NULL); pwlen=16; + } else { + memcpy(Kxoripad, passwd, pwlen); } + memcpy(Kxoropad,Kxoripad,pwlen); - memset(Kxoripad,0,sizeof(Kxoripad)); - memset(Kxoropad,0,sizeof(Kxoropad)); - memcpy(Kxoripad,pwinput,pwlen); - memcpy(Kxoropad,pwinput,pwlen); for (i=0;i<64;i++) { Kxoripad[i]^=0x36; Kxoropad[i]^=0x5c; @@ -1590,7 +1588,7 @@ gaim_cipher_context_reset(ctx, NULL); gaim_cipher_context_append(ctx, Kxoropad, 64); gaim_cipher_context_append(ctx, Kxoripad, 16); - gaim_cipher_context_digest(ctx, sizeof(response), response, NULL); + gaim_cipher_context_digest(ctx, 16, response, NULL); gaim_cipher_context_destroy(ctx); }