Merge branch '401-null-pointer-de-reference-found-in-bind-9-12-1-p2' into 'master'

Resolve "NULL Pointer de-reference found in BIND 9.12.1-P2"

Closes #401

See merge request isc-projects/bind9!487
This commit is contained in:
Evan Hunt
2018-07-10 17:33:17 -04:00
2 changed files with 21 additions and 4 deletions

View File

@@ -1,3 +1,6 @@
4990. [bug] Prevent a possible NULL reference in pkcs11-keygen.
[GL #401]
4989. [cleanup] IDN support in dig has been reworked. IDNA2003
fallbacks were removed in the process. [GL #384]

View File

@@ -657,8 +657,18 @@ main(int argc, char *argv[]) {
}
/* Allocate space for parameter attributes */
for (i = 0; i < param_attrcnt; i++)
for (i = 0; i < param_attrcnt; i++) {
param_template[i].pValue = NULL;
}
for (i = 0; i < param_attrcnt; i++) {
param_template[i].pValue = malloc(param_template[i].ulValueLen);
if (param_template[i].pValue == NULL) {
fprintf(stderr, "malloc failed\n");
error = 1;
goto exit_params;
}
}
rv = pkcs_C_GetAttributeValue(hSession, domainparams,
dsa_param_template, DSA_PARAM_ATTRS);
@@ -713,9 +723,13 @@ main(int argc, char *argv[]) {
exit_params:
/* Free parameter attributes */
if (keyclass == key_dsa || keyclass == key_dh)
for (i = 0; i < param_attrcnt; i++)
free(param_template[i].pValue);
if (keyclass == key_dsa || keyclass == key_dh) {
for (i = 0; i < param_attrcnt; i++) {
if (param_template[i].pValue != NULL) {
free(param_template[i].pValue);
}
}
}
exit_domain:
/* Destroy domain parameters */