base64: Fixed compilation warnings when using Curl_base64_decode()
curl_sasl.c:294: warning: dereferencing type-punned pointer will break strict-aliasing rules getpart.c:201: warning: dereferencing type-punned pointer will break strict-aliasing rules
This commit is contained in:
Родитель
5094bb53f4
Коммит
5b315a273e
|
@ -286,12 +286,12 @@ CURLcode Curl_sasl_decode_digest_md5_message(const char *chlg64,
|
||||||
char *alg, size_t alen)
|
char *alg, size_t alen)
|
||||||
{
|
{
|
||||||
CURLcode result = CURLE_OK;
|
CURLcode result = CURLE_OK;
|
||||||
char *chlg = NULL;
|
unsigned char *chlg = NULL;
|
||||||
size_t chlglen = 0;
|
size_t chlglen = 0;
|
||||||
size_t chlg64len = strlen(chlg64);
|
size_t chlg64len = strlen(chlg64);
|
||||||
|
|
||||||
if(chlg64len && *chlg64 != '=') {
|
if(chlg64len && *chlg64 != '=') {
|
||||||
result = Curl_base64_decode(chlg64, (unsigned char **) &chlg, &chlglen);
|
result = Curl_base64_decode(chlg64, &chlg, &chlglen);
|
||||||
if(result)
|
if(result)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -301,19 +301,19 @@ CURLcode Curl_sasl_decode_digest_md5_message(const char *chlg64,
|
||||||
return CURLE_BAD_CONTENT_ENCODING;
|
return CURLE_BAD_CONTENT_ENCODING;
|
||||||
|
|
||||||
/* Retrieve nonce string from the challenge */
|
/* Retrieve nonce string from the challenge */
|
||||||
if(!sasl_digest_get_key_value(chlg, "nonce=\"", nonce, nlen, '\"')) {
|
if(!sasl_digest_get_key_value((char *)chlg, "nonce=\"", nonce, nlen, '\"')) {
|
||||||
Curl_safefree(chlg);
|
Curl_safefree(chlg);
|
||||||
return CURLE_BAD_CONTENT_ENCODING;
|
return CURLE_BAD_CONTENT_ENCODING;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Retrieve realm string from the challenge */
|
/* Retrieve realm string from the challenge */
|
||||||
if(!sasl_digest_get_key_value(chlg, "realm=\"", realm, rlen, '\"')) {
|
if(!sasl_digest_get_key_value((char *)chlg, "realm=\"", realm, rlen, '\"')) {
|
||||||
/* Challenge does not have a realm, set empty string [RFC2831] page 6 */
|
/* Challenge does not have a realm, set empty string [RFC2831] page 6 */
|
||||||
strcpy(realm, "");
|
strcpy(realm, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Retrieve algorithm string from the challenge */
|
/* Retrieve algorithm string from the challenge */
|
||||||
if(!sasl_digest_get_key_value(chlg, "algorithm=", alg, alen, ',')) {
|
if(!sasl_digest_get_key_value((char *)chlg, "algorithm=", alg, alen, ',')) {
|
||||||
Curl_safefree(chlg);
|
Curl_safefree(chlg);
|
||||||
return CURLE_BAD_CONTENT_ENCODING;
|
return CURLE_BAD_CONTENT_ENCODING;
|
||||||
}
|
}
|
||||||
|
|
|
@ -191,14 +191,14 @@ static int decodedata(char **buf, /* dest buffer */
|
||||||
size_t *len) /* dest buffer data length */
|
size_t *len) /* dest buffer data length */
|
||||||
{
|
{
|
||||||
int error = 0;
|
int error = 0;
|
||||||
char *buf64 = NULL;
|
unsigned char *buf64 = NULL;
|
||||||
size_t src_len = 0;
|
size_t src_len = 0;
|
||||||
|
|
||||||
if(!*len)
|
if(!*len)
|
||||||
return GPE_OK;
|
return GPE_OK;
|
||||||
|
|
||||||
/* base64 decode the given buffer */
|
/* base64 decode the given buffer */
|
||||||
error = (int) Curl_base64_decode(*buf, (unsigned char **) &buf64, &src_len);
|
error = (int) Curl_base64_decode(*buf, &buf64, &src_len);
|
||||||
if(error)
|
if(error)
|
||||||
return GPE_OUT_OF_MEMORY;
|
return GPE_OUT_OF_MEMORY;
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче