mirror of
https://github.com/owntone/owntone-server.git
synced 2025-04-18 01:50:32 -04:00
Misc fixup to keep scan-build happy
This commit is contained in:
parent
20128e2235
commit
01308f7f83
@ -565,7 +565,7 @@ m_readfile(const char *path, int num_lines)
|
|||||||
}
|
}
|
||||||
|
|
||||||
lines[i] = trimwhitespace(line);
|
lines[i] = trimwhitespace(line);
|
||||||
if (strlen(lines[i]) == 0)
|
if (!lines[i] || (strlen(lines[i]) == 0))
|
||||||
{
|
{
|
||||||
DPRINTF(E_LOG, L_MISC, "Line %d in '%s' is invalid\n", i+1, path);
|
DPRINTF(E_LOG, L_MISC, "Line %d in '%s' is invalid\n", i+1, path);
|
||||||
goto error;
|
goto error;
|
||||||
|
@ -257,8 +257,6 @@ static NGConstant *
|
|||||||
new_ng(SRP_NGType ng_type, const char *n_hex, const char *g_hex)
|
new_ng(SRP_NGType ng_type, const char *n_hex, const char *g_hex)
|
||||||
{
|
{
|
||||||
NGConstant *ng = calloc(1, sizeof(NGConstant));
|
NGConstant *ng = calloc(1, sizeof(NGConstant));
|
||||||
if(!ng)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
if ( ng_type != SRP_NG_CUSTOM )
|
if ( ng_type != SRP_NG_CUSTOM )
|
||||||
{
|
{
|
||||||
@ -411,8 +409,6 @@ H_nn_pad(enum hash_alg alg, const bnum n1, const bnum n2)
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
bin = calloc( 1, nbytes );
|
bin = calloc( 1, nbytes );
|
||||||
if (!bin)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
bnum_bn2bin(n1, bin, len_n1);
|
bnum_bn2bin(n1, bin, len_n1);
|
||||||
bnum_bn2bin(n2, bin + nbytes - len_n2, len_n2);
|
bnum_bn2bin(n2, bin + nbytes - len_n2, len_n2);
|
||||||
@ -430,8 +426,6 @@ H_ns(enum hash_alg alg, const bnum n, const unsigned char *bytes, int len_bytes)
|
|||||||
int len_n = bnum_num_bytes(n);
|
int len_n = bnum_num_bytes(n);
|
||||||
int nbytes = len_n + len_bytes;
|
int nbytes = len_n + len_bytes;
|
||||||
unsigned char *bin = malloc(nbytes);
|
unsigned char *bin = malloc(nbytes);
|
||||||
if (!bin)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
bnum_bn2bin(n, bin, len_n);
|
bnum_bn2bin(n, bin, len_n);
|
||||||
memcpy( bin + len_n, bytes, len_bytes );
|
memcpy( bin + len_n, bytes, len_bytes );
|
||||||
@ -461,8 +455,6 @@ update_hash_n(enum hash_alg alg, HashCTX *ctx, const bnum n)
|
|||||||
{
|
{
|
||||||
unsigned long len = bnum_num_bytes(n);
|
unsigned long len = bnum_num_bytes(n);
|
||||||
unsigned char *n_bytes = malloc(len);
|
unsigned char *n_bytes = malloc(len);
|
||||||
if (!n_bytes)
|
|
||||||
return;
|
|
||||||
bnum_bn2bin(n, n_bytes, len);
|
bnum_bn2bin(n, n_bytes, len);
|
||||||
hash_update(alg, ctx, n_bytes, len);
|
hash_update(alg, ctx, n_bytes, len);
|
||||||
free(n_bytes);
|
free(n_bytes);
|
||||||
@ -473,8 +465,6 @@ hash_num(enum hash_alg alg, const bnum n, unsigned char *dest)
|
|||||||
{
|
{
|
||||||
int nbytes = bnum_num_bytes(n);
|
int nbytes = bnum_num_bytes(n);
|
||||||
unsigned char *bin = malloc(nbytes);
|
unsigned char *bin = malloc(nbytes);
|
||||||
if(!bin)
|
|
||||||
return;
|
|
||||||
bnum_bn2bin(n, bin, nbytes);
|
bnum_bn2bin(n, bin, nbytes);
|
||||||
hash( alg, bin, nbytes, dest );
|
hash( alg, bin, nbytes, dest );
|
||||||
free(bin);
|
free(bin);
|
||||||
@ -486,8 +476,7 @@ hash_session_key(enum hash_alg alg, const bnum n, unsigned char *dest)
|
|||||||
int nbytes = bnum_num_bytes(n);
|
int nbytes = bnum_num_bytes(n);
|
||||||
unsigned char *bin = malloc(nbytes);
|
unsigned char *bin = malloc(nbytes);
|
||||||
unsigned char fourbytes[4] = { 0 }; // Only God knows the reason for this, and perhaps some poor soul at Apple
|
unsigned char fourbytes[4] = { 0 }; // Only God knows the reason for this, and perhaps some poor soul at Apple
|
||||||
if(!bin)
|
|
||||||
return 0;
|
|
||||||
bnum_bn2bin(n, bin, nbytes);
|
bnum_bn2bin(n, bin, nbytes);
|
||||||
|
|
||||||
hash_ab(alg, dest, bin, nbytes, fourbytes, sizeof(fourbytes));
|
hash_ab(alg, dest, bin, nbytes, fourbytes, sizeof(fourbytes));
|
||||||
@ -518,7 +507,7 @@ calculate_M(enum hash_alg alg, NGConstant *ng, unsigned char *dest, const char *
|
|||||||
|
|
||||||
hash(alg, (const unsigned char *)I, strlen(I), H_I);
|
hash(alg, (const unsigned char *)I, strlen(I), H_I);
|
||||||
|
|
||||||
for (i=0; i < hash_len; i++ )
|
for (i = 0; i < hash_len; i++)
|
||||||
H_xor[i] = H_N[i] ^ H_g[i];
|
H_xor[i] = H_N[i] ^ H_g[i];
|
||||||
|
|
||||||
hash_init( alg, &ctx );
|
hash_init( alg, &ctx );
|
||||||
@ -1189,13 +1178,16 @@ verification_verify_new(const char *authorisation_key)
|
|||||||
if (sodium_init() == -1)
|
if (sodium_init() == -1)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
vctx = calloc(1, sizeof(struct verification_verify_context));
|
if (!authorisation_key)
|
||||||
if (!vctx)
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (strlen(authorisation_key) != 2 * (sizeof(vctx->client_public_key) + sizeof(vctx->client_private_key)))
|
if (strlen(authorisation_key) != 2 * (sizeof(vctx->client_public_key) + sizeof(vctx->client_private_key)))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
vctx = calloc(1, sizeof(struct verification_verify_context));
|
||||||
|
if (!vctx)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
ptr = authorisation_key;
|
ptr = authorisation_key;
|
||||||
for (i = 0; i < sizeof(vctx->client_public_key); i++, ptr+=2)
|
for (i = 0; i < sizeof(vctx->client_public_key); i++, ptr+=2)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user