mirror of
https://github.com/transmission/transmission
synced 2025-01-01 12:35:22 +00:00
Make sure tr_sha1
calls pass lengths as int
This fixes inability to authenticate with password-protected session, and a few more issues it seems.
This commit is contained in:
parent
f9c0ce63b8
commit
eda26f7590
3 changed files with 4 additions and 4 deletions
|
@ -141,7 +141,7 @@ tr_ssha1 (const char * plain_text)
|
|||
for (i = 0; i < saltval_len; ++i)
|
||||
salt[i] = salter[salt[i] % salter_len];
|
||||
|
||||
tr_sha1 (sha, plain_text, strlen (plain_text), salt, (size_t) saltval_len, NULL);
|
||||
tr_sha1 (sha, plain_text, (int) strlen (plain_text), salt, saltval_len, NULL);
|
||||
tr_sha1_to_hex (&buf[1], sha);
|
||||
memcpy (&buf[1 + 2 * SHA_DIGEST_LENGTH], &salt, saltval_len);
|
||||
buf[1 + 2 * SHA_DIGEST_LENGTH + saltval_len] = '\0';
|
||||
|
@ -170,7 +170,7 @@ tr_ssha1_matches (const char * ssha1,
|
|||
|
||||
/* hash pass + salt */
|
||||
my_ssha1 = tr_malloc (2 * SHA_DIGEST_LENGTH + saltlen + 2);
|
||||
tr_sha1 (buf, plain_text, strlen (plain_text), salt, saltlen, NULL);
|
||||
tr_sha1 (buf, plain_text, (int) strlen (plain_text), salt, (int) saltlen, NULL);
|
||||
tr_sha1_to_hex (&my_ssha1[1], buf);
|
||||
memcpy (my_ssha1 + 1 + 2 * SHA_DIGEST_LENGTH, salt, saltlen);
|
||||
my_ssha1[1 + 2 * SHA_DIGEST_LENGTH + saltlen] = '\0';
|
||||
|
|
|
@ -293,7 +293,7 @@ getHashInfo (tr_metainfo_builder * b)
|
|||
|
||||
assert (bufptr - buf == (int)thisPieceSize);
|
||||
assert (leftInPiece == 0);
|
||||
tr_sha1 (walk, buf, thisPieceSize, NULL);
|
||||
tr_sha1 (walk, buf, (int) thisPieceSize, NULL);
|
||||
walk += SHA_DIGEST_LENGTH;
|
||||
|
||||
if (b->abortFlag)
|
||||
|
|
|
@ -469,7 +469,7 @@ tr_metainfoParseImpl (const tr_session * session,
|
|||
{
|
||||
size_t len;
|
||||
char * bstr = tr_variantToStr (infoDict, TR_VARIANT_FMT_BENC, &len);
|
||||
tr_sha1 (inf->hash, bstr, len, NULL);
|
||||
tr_sha1 (inf->hash, bstr, (int) len, NULL);
|
||||
tr_sha1_to_hex (inf->hashString, inf->hash);
|
||||
|
||||
if (infoDictLength != NULL)
|
||||
|
|
Loading…
Reference in a new issue