Line
Link Here
|
0 |
-- a/gnutls.c |
0 |
++ b/gnutls.c |
Lines 556-564
static int count_x509_certificates(gnutls_datum_t *datum)
Link Here
|
556 |
|
556 |
|
557 |
static int get_cert_name(gnutls_x509_crt_t cert, char *name, size_t namelen) |
557 |
static int get_cert_name(gnutls_x509_crt_t cert, char *name, size_t namelen) |
558 |
{ |
558 |
{ |
|
|
559 |
/* We assume 'nl' is updated only when gnutls_x509_crt_get_dn*() |
560 |
* fail. Avoid clobbering original 'namelen'. */ |
561 |
size_t nl = namelen; |
559 |
if (gnutls_x509_crt_get_dn_by_oid(cert, GNUTLS_OID_X520_COMMON_NAME, |
562 |
if (gnutls_x509_crt_get_dn_by_oid(cert, GNUTLS_OID_X520_COMMON_NAME, |
560 |
0, 0, name, &namelen) && |
563 |
0, 0, name, &nl) && |
561 |
gnutls_x509_crt_get_dn(cert, name, &namelen)) { |
564 |
gnutls_x509_crt_get_dn(cert, name, &nl)) { |
562 |
name[namelen-1] = 0; |
565 |
name[namelen-1] = 0; |
563 |
snprintf(name, namelen-1, "<unknown>"); |
566 |
snprintf(name, namelen-1, "<unknown>"); |
564 |
return -EINVAL; |
567 |
return -EINVAL; |