]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
clang warning fixes
authorNikos Mavrogiannopoulos <nmav@gnutls.org>
Sat, 8 Mar 2014 14:42:47 +0000 (15:42 +0100)
committerNikos Mavrogiannopoulos <nmav@gnutls.org>
Sat, 8 Mar 2014 14:42:47 +0000 (15:42 +0100)
lib/auth/cert.c
lib/opencdk/armor.c
lib/openpgp/pgp.c
lib/verify-tofu.c

index 599b85db5e8af571f75cdb32bca6eb6d10525606..6e86091b7169b418327b2aca06e5ce478c4c168d 100644 (file)
@@ -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
index 5bfcd167b09209dac0ff3e874446a2245f475824..2d921ec8f3f651cedec74f33c80066ccec05f1be 100644 (file)
@@ -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,
index e242da187d41486cb580e22dfb4385a0a121426f..6b15e9856bebf5300bb8342b4ebc91efa505fd6a 100644 (file)
@@ -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. */
index e640a72031bfaa02d6e38091753eb46e0d9976e8..28b1090fd3841fe16a7cbeff151444d7026865da 100644 (file)
@@ -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 */