identification: Fix printing of empty RDNs on FreeBSD

On FreeBSD (null) is printed for NULL even if the precision is 0.
This commit is contained in:
Tobias Brunner 2014-01-27 13:50:28 +01:00
parent f8c9c03de0
commit 5e75f50b70
1 changed files with 6 additions and 1 deletions

View File

@ -332,8 +332,13 @@ static void dntoa(chunk_t dn, char *buf, size_t len)
buf += written;
len -= written;
written = 0;
chunk_printable(data, &printable, '?');
written = snprintf(buf, len, "%.*s", (int)printable.len, printable.ptr);
if (printable.ptr)
{
written = snprintf(buf, len, "%.*s", (int)printable.len,
printable.ptr);
}
chunk_free(&printable);
if (written < 0 || written >= len)
{