summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2018-11-09 20:11:42 +0100
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2018-11-10 07:20:13 +0100
commitf3da49beff97b399325f4616b6096d7bbdec268d (patch)
treea238bef7c9a8472b9d726c46f670decbcc57f95c
parent59497c0e3550f65956809962ab9e6c5c723abeeb (diff)
downloadgnutls-f3da49beff97b399325f4616b6096d7bbdec268d.tar.gz
Added checks to avoid false negatives reported by static analyzers
Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
-rw-r--r--lib/x509/dn.c2
-rw-r--r--lib/x509/x509.c9
2 files changed, 9 insertions, 2 deletions
diff --git a/lib/x509/dn.c b/lib/x509/dn.c
index 07b9d94b6b..828bd9059d 100644
--- a/lib/x509/dn.c
+++ b/lib/x509/dn.c
@@ -286,6 +286,8 @@ _gnutls_x509_parse_dn(ASN1_TYPE asn1_struct,
goto cleanup;
}
+ assert(dn.data != NULL);
+
if (buf) {
memcpy(buf, dn.data, dn.size);
buf[dn.size] = 0;
diff --git a/lib/x509/x509.c b/lib/x509/x509.c
index 1880f6acc3..6fe6cd91c3 100644
--- a/lib/x509/x509.c
+++ b/lib/x509/x509.c
@@ -154,6 +154,9 @@ gnutls_x509_crt_equals2(gnutls_x509_crt_t cert1,
{
bool result;
+ if (cert1 == NULL || der == NULL)
+ return 0;
+
if (cert1->der.size == 0 || cert1->modified) {
gnutls_datum_t tmp1;
int ret;
@@ -4196,8 +4199,10 @@ void gnutls_x509_crt_set_pin_function(gnutls_x509_crt_t crt,
gnutls_pin_callback_t fn,
void *userdata)
{
- crt->pin.cb = fn;
- crt->pin.data = userdata;
+ if (crt) {
+ crt->pin.cb = fn;
+ crt->pin.data = userdata;
+ }
}
/**