From 68fd14b144d44cc94c84fc5a4fb05a488eb06b4f Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Mon, 19 Jan 2009 16:15:30 +0000 Subject: Add a few translations to the audit-log. --- common/convert.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'common/convert.c') diff --git a/common/convert.c b/common/convert.c index c946b81b1..d3e8b642e 100644 --- a/common/convert.c +++ b/common/convert.c @@ -194,7 +194,9 @@ hex2str (const char *hexstring, char *buffer, size_t bufsize, size_t *buflen) ; if (*s && (!isascii (*s) || !isspace (*s)) ) return NULL; /* Not followed by Nul or white space. */ - need_nul = !(s[-2] == '0' && s[-1] == '0'); + /* We need to append a nul character. However we don't want that if + the hexstring already ends with "00". */ + need_nul = ((s == hexstring) || !(s[-2] == '0' && s[-1] == '0')); if (need_nul) count++; -- cgit v1.2.3