use entity for colon in certificate hex values to allow netsurf to break properly

This commit is contained in:
Vincent Sanders 2020-05-17 15:20:30 +01:00
parent 6002efff27
commit aaa507b09f

View File

@ -669,6 +669,9 @@ xname_to_info(X509_NAME *xname, struct ns_cert_name *iname)
/**
* duplicate a hex formatted string inserting the colons
*
* \todo only uses html entity as separator because netsurfs line breaking
* fails otherwise.
*/
static char *hexdup(const char *hex)
{
@ -678,13 +681,18 @@ static char *hexdup(const char *hex)
int cn = 0;
hexlen = strlen(hex);
dst = malloc(((hexlen * 3) + 1) / 2);
/* allow space fox XXYY to XX:YY: */
dst = malloc(((hexlen * 7) + 6) / 2);
if (dst != NULL) {
for (out = dst; *hex != 0; hex++) {
if (cn == 2) {
cn = 0;
*out++ = ':';
*out++ = '&';
*out++ = '#';
*out++ = '5';
*out++ = '8';
*out++ = ';';
}
*out++ = *hex;
cn++;