diff options
author | Tobias Brunner <tobias@strongswan.org> | 2014-01-27 13:50:28 +0100 |
---|---|---|
committer | Tobias Brunner <tobias@strongswan.org> | 2014-02-12 13:45:42 +0100 |
commit | 5e75f50b704194c8b1444b7dad4d2e74fe5d51e4 (patch) | |
tree | 3e6db7af4630e18d230725f699c42f1fc16ae19d | |
parent | f8c9c03de0849a9c6f2bde633afd95c7c0632ebf (diff) | |
download | strongswan-5e75f50b704194c8b1444b7dad4d2e74fe5d51e4.tar.bz2 strongswan-5e75f50b704194c8b1444b7dad4d2e74fe5d51e4.tar.xz |
identification: Fix printing of empty RDNs on FreeBSD
On FreeBSD (null) is printed for NULL even if the precision is 0.
-rw-r--r-- | src/libstrongswan/utils/identification.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/libstrongswan/utils/identification.c b/src/libstrongswan/utils/identification.c index 9c43ad570..e7eb63bc6 100644 --- a/src/libstrongswan/utils/identification.c +++ b/src/libstrongswan/utils/identification.c @@ -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) { |