die_openssl_err(const char *msg)
{
char err_string[250];
die_openssl_err(const char *msg)
{
char err_string[250];
ERR_error_string_n(ERR_get_error(), err_string, sizeof(err_string));
die("%s: %s", msg, err_string);
ERR_error_string_n(ERR_get_error(), err_string, sizeof(err_string));
die("%s: %s", msg, err_string);
int rc;
len = strlen(text);
int rc;
len = strlen(text);
- spaceless = malloc(len);
+ spaceless = malloc(len + 1);
- die("malloc(%zu) failed: %s", len, strerror(errno));
+ die("malloc(%zu) failed: %s", len + 1, strerror(errno));
for (p = spaceless, q = text, end = text + len;
q < end;
for (p = spaceless, q = text, end = text + len;
q < end;
if (!isspace(*q))
*p++ = *q;
}
if (!isspace(*q))
*p++ = *q;
}
+ len = p - spaceless;
+ *p++ = '\0';
b = NULL;
rc = BN_hex2bn(&b, spaceless);
b = NULL;
rc = BN_hex2bn(&b, spaceless);
- if (rc != p - spaceless)
die("BN_hex2bn did not convert entire input; took %d of %zu bytes",
die("BN_hex2bn did not convert entire input; took %d of %zu bytes",