Fix warnings (some bugs, some spurious)

Many spurious VC warnings not quieted though.
This commit is contained in:
Nicolas Williams
2020-03-12 00:42:33 -05:00
parent f3e6c4ffd4
commit 64d5f86ec3
20 changed files with 38 additions and 36 deletions

View File

@@ -619,7 +619,7 @@ mk_temp(const char *fn, char **tfn)
return -1;
}
if (p = strrchr(ds, '\\') == NULL) {
if ((p = strrchr(ds, '\\')) == NULL) {
ret = asprintf(tfn, ".%s-XXXXXX", ds); /* XXX can't happen */
} else {
*(p++) = '\0';

View File

@@ -368,7 +368,7 @@ dsstringprep(const DirectoryString *ds, uint32_t **rname, size_t *rlen)
{
wind_profile_flags flags;
size_t i, len;
int ret;
int ret = 0;
uint32_t *name;
*rname = NULL;
@@ -418,7 +418,10 @@ dsstringprep(const DirectoryString *ds, uint32_t **rname, size_t *rlen)
/* try a couple of times to get the length right, XXX gross */
for (i = 0; i < 4; i++) {
*rlen = *rlen * 2;
*rname = malloc(*rlen * sizeof((*rname)[0]));
if ((*rname = malloc(*rlen * sizeof((*rname)[0]))) == NULL) {
ret = ENOMEM;
break;
}
ret = wind_stringprep(name, len, *rname, rlen, flags);
if (ret == WIND_ERR_OVERRUN) {

View File

@@ -636,7 +636,7 @@ hx509_request_to_pkcs10(hx509_context context,
if (ret == 0)
ret = get_exts(context, req, &exts);
if (ret == 0 && exts.len) {
Attribute *a;
Attribute *a = NULL; /* Quiet VC */
heim_any extns;
r.certificationRequestInfo.attributes =
@@ -655,7 +655,7 @@ hx509_request_to_pkcs10(hx509_context context,
if (ret == 0)
ASN1_MALLOC_ENCODE(Extensions, extns.data, extns.length,
&exts, &size, ret);
if (ret == 0)
if (ret == 0 && a)
ret = der_copy_oid(&asn1_oid_id_pkcs9_extReq, &a->type);
if (ret == 0)
ret = add_AttributeValues(&a->value, &extns);