goto start;
ret = snprintf(buf, sizeof buf, "%s_default", v->name);
if (ret == -1 || ret >= sizeof(buf)) {
- BIO_printf(bio_err, "Name '%s' too long\n", v->name);
+ BIO_printf(bio_err, "Name '%s' too long for default\n",
+ v->name);
return 0;
}
if ((def = NCONF_get_string(req_conf, dn_sect, buf)) == NULL) {
ERR_clear_error();
def = "";
}
- snprintf(buf, sizeof buf, "%s_value", v->name);
+ ret = snprintf(buf, sizeof buf, "%s_value", v->name);
+ if (ret == -1 || ret >= sizeof(buf)) {
+ BIO_printf(bio_err, "Name '%s' too long for value\n",
+ v->name);
+ return 0;
+ }
if ((value = NCONF_get_string(req_conf, dn_sect, buf)) == NULL) {
ERR_clear_error();
value = NULL;
}
- snprintf(buf, sizeof buf, "%s_min", v->name);
+ ret = snprintf(buf, sizeof buf, "%s_min", v->name);
+ if (ret == -1 || ret >= sizeof(buf)) {
+ BIO_printf(bio_err, "Name '%s' too long for min\n",
+ v->name);
+ return 0;
+ }
if (!NCONF_get_number(req_conf, dn_sect, buf, &n_min)) {
ERR_clear_error();
n_min = -1;
}
- snprintf(buf, sizeof buf, "%s_max", v->name);
+ ret = snprintf(buf, sizeof buf, "%s_max", v->name);
+ if (ret == -1 || ret >= sizeof(buf)) {
+ BIO_printf(bio_err, "Name '%s' too long for max\n",
+ v->name);
+ return 0;
+ }
if (!NCONF_get_number(req_conf, dn_sect, buf, &n_max)) {
ERR_clear_error();
n_max = -1;
return 0;
}
if (attribs) {
- if ((attr_sk != NULL) && (sk_CONF_VALUE_num(attr_sk) > 0) && (!batch)) {
- BIO_printf(bio_err, "\nPlease enter the following 'extra' attributes\n");
- BIO_printf(bio_err, "to be sent with your certificate request\n");
+ if ((attr_sk != NULL) && (sk_CONF_VALUE_num(attr_sk) > 0) &&
+ (!batch)) {
+ BIO_printf(bio_err,
+ "\nPlease enter the following 'extra' attributes\n");
+ BIO_printf(bio_err,
+ "to be sent with your certificate request\n");
}
i = -1;
- start2: for (;;) {
+start2: for (;;) {
int ret;
i++;
if ((attr_sk == NULL) ||
goto start2;
ret = snprintf(buf, sizeof buf, "%s_default", type);
if (ret == -1 || ret >= sizeof(buf)) {
- BIO_printf(bio_err, "Name '%s' too long\n", v->name);
+ BIO_printf(bio_err, "Name '%s' too long for default\n",
+ v->name);
return 0;
}
if ((def = NCONF_get_string(req_conf, attr_sect, buf))
ERR_clear_error();
def = "";
}
- snprintf(buf, sizeof buf, "%s_value", type);
+ ret = snprintf(buf, sizeof buf, "%s_value", type);
+ if (ret == -1 || ret >= sizeof(buf)) {
+ BIO_printf(bio_err, "Name '%s' too long for value\n",
+ v->name);
+ return 0;
+ }
if ((value = NCONF_get_string(req_conf, attr_sect, buf))
== NULL) {
ERR_clear_error();
value = NULL;
}
- snprintf(buf, sizeof buf, "%s_min", type);
+ ret = snprintf(buf, sizeof buf, "%s_min", type);
+ if (ret == -1 || ret >= sizeof(buf)) {
+ BIO_printf(bio_err, "Name '%s' too long for min\n",
+ v->name);
+ return 0;
+ }
if (!NCONF_get_number(req_conf, attr_sect, buf, &n_min)) {
ERR_clear_error();
n_min = -1;
}
- snprintf(buf, sizeof buf, "%s_max", type);
+ ret = snprintf(buf, sizeof buf, "%s_max", type);
+ if (ret == -1 || ret >= sizeof(buf)) {
+ BIO_printf(bio_err, "Name '%s' too long for max\n",
+ v->name);
+ return 0;
+ }
if (!NCONF_get_number(req_conf, attr_sect, buf, &n_max)) {
ERR_clear_error();
n_max = -1;
goto end;
if (s_www_path != NULL) {
- snprintf(buf, sizeof buf, "GET %s HTTP/1.0\r\n\r\n", s_www_path);
+ int ret = snprintf(buf, sizeof buf,
+ "GET %s HTTP/1.0\r\n\r\n", s_www_path);
+ if (ret == -1 || ret >= sizeof buf) {
+ fprintf(stderr, "URL too long\n");
+ goto end;
+ }
SSL_write(scon, buf, strlen(buf));
while ((i = SSL_read(scon, buf, sizeof(buf))) > 0)
bytes_read += i;
goto end;
}
if (s_www_path != NULL) {
- snprintf(buf, sizeof buf, "GET %s HTTP/1.0\r\n\r\n", s_www_path);
+ int ret = snprintf(buf, sizeof buf,
+ "GET %s HTTP/1.0\r\n\r\n", s_www_path);
+ if (ret == -1 || ret >= sizeof buf) {
+ fprintf(stderr, "URL too long\n");
+ goto end;
+ }
SSL_write(scon, buf, strlen(buf));
while (SSL_read(scon, buf, sizeof(buf)) > 0);
}
goto end;
if (s_www_path) {
- snprintf(buf, sizeof buf, "GET %s HTTP/1.0\r\n\r\n", s_www_path);
+ int ret = snprintf(buf, sizeof buf,
+ "GET %s HTTP/1.0\r\n\r\n", s_www_path);
+ if (ret == -1 || ret >= sizeof buf) {
+ fprintf(stderr, "URL too long\n");
+ goto end;
+ }
SSL_write(scon, buf, strlen(buf));
while ((i = SSL_read(scon, buf, sizeof(buf))) > 0)
bytes_read += i;