summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2014-03-08 15:42:47 +0100
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2014-03-08 17:12:55 +0100
commit922eb184af1f18e7bc6398bdd0f92844b422d9fa (patch)
treedfcd6dc6d6cabc04bcd567d0e6d7791c4feb25f4 /lib
parentde76df0f3ca5d1e744d71d3ad00a675233bf7705 (diff)
downloadgnutls-922eb184af1f18e7bc6398bdd0f92844b422d9fa.tar.gz
clang warning fixes
Diffstat (limited to 'lib')
-rw-r--r--lib/auth/cert.c2
-rw-r--r--lib/opencdk/armor.c2
-rw-r--r--lib/openpgp/pgp.c11
-rw-r--r--lib/verify-tofu.c8
4 files changed, 16 insertions, 7 deletions
diff --git a/lib/auth/cert.c b/lib/auth/cert.c
index 606e798607..863f15f2e3 100644
--- a/lib/auth/cert.c
+++ b/lib/auth/cert.c
@@ -257,7 +257,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 7a26c6b80f..5d978f5864 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 0c714e8e4c..a4112a516f 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 */