From: Nikos Mavrogiannopoulos Date: Sat, 8 Mar 2014 14:42:47 +0000 (+0100) Subject: clang warning fixes X-Git-Tag: gnutls_3_3_0pre0~53 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ac2ec01a3db21f8d9a567ed6438f4840db2c309f;p=thirdparty%2Fgnutls.git clang warning fixes --- diff --git a/lib/auth/cert.c b/lib/auth/cert.c index 599b85db5e..6e86091b71 100644 --- a/lib/auth/cert.c +++ b/lib/auth/cert.c @@ -258,7 +258,7 @@ _find_x509_cert(const gnutls_certificate_credentials_t cred, return result; } - if (odn.size != size) + if (odn.size == 0 || odn.size != size) continue; /* If the DN matches and diff --git a/lib/opencdk/armor.c b/lib/opencdk/armor.c index 5bfcd167b0..2d921ec8f3 100644 --- a/lib/opencdk/armor.c +++ b/lib/opencdk/armor.c @@ -42,7 +42,7 @@ #define CRCINIT 0xB704CE -static u32 crc_table[] = { +static const u32 crc_table[] = { 0x000000, 0x864CFB, 0x8AD50D, 0x0C99F6, 0x93E6E1, 0x15AA1A, 0x1933EC, 0x9F7F17, 0xA18139, 0x27CDC2, 0x2B5434, 0xAD18CF, 0x3267D8, diff --git a/lib/openpgp/pgp.c b/lib/openpgp/pgp.c index e242da187d..6b15e9856b 100644 --- a/lib/openpgp/pgp.c +++ b/lib/openpgp/pgp.c @@ -169,7 +169,16 @@ _gnutls_openpgp_export(cdk_kbnode_t node, if (format == GNUTLS_OPENPGP_FMT_BASE64) { unsigned char *in = gnutls_calloc(1, *output_data_size); - memcpy(in, output_data, *output_data_size); + if (in == NULL) + return gnutls_assert_val(GNUTLS_E_MEMORY_ERROR); + + rc = cdk_kbnode_write_to_mem(node, in, output_data_size); + if (rc) { + gnutls_free(in); + rc = _gnutls_map_cdk_rc(rc); + gnutls_assert(); + return rc; + } /* Calculate the size of the encoded data and check if the provided buffer is large enough. */ diff --git a/lib/verify-tofu.c b/lib/verify-tofu.c index e640a72031..28b1090fd3 100644 --- a/lib/verify-tofu.c +++ b/lib/verify-tofu.c @@ -172,7 +172,7 @@ static int parse_commitment_line(char *line, if (p == NULL) return gnutls_assert_val(GNUTLS_E_PARSING_ERROR); - if (p[0] != '*' && strcmp(p, host) != 0) + if (p[0] != '*' && host != NULL && strcmp(p, host) != 0) return gnutls_assert_val(GNUTLS_E_PARSING_ERROR); /* read service */ @@ -180,7 +180,7 @@ static int parse_commitment_line(char *line, if (p == NULL) return gnutls_assert_val(GNUTLS_E_PARSING_ERROR); - if (p[0] != '*' && strcmp(p, service) != 0) + if (p[0] != '*' && service != NULL && strcmp(p, service) != 0) return gnutls_assert_val(GNUTLS_E_PARSING_ERROR); /* read expiration */ @@ -268,7 +268,7 @@ static int parse_line(char *line, if (p == NULL) return gnutls_assert_val(GNUTLS_E_PARSING_ERROR); - if (p[0] != '*' && strcmp(p, host) != 0) + if (p[0] != '*' && host != NULL && strcmp(p, host) != 0) return gnutls_assert_val(GNUTLS_E_PARSING_ERROR); /* read service */ @@ -276,7 +276,7 @@ static int parse_line(char *line, if (p == NULL) return gnutls_assert_val(GNUTLS_E_PARSING_ERROR); - if (p[0] != '*' && strcmp(p, service) != 0) + if (p[0] != '*' && service != NULL && strcmp(p, service) != 0) return gnutls_assert_val(GNUTLS_E_PARSING_ERROR); /* read expiration */