summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorAnil Madhavapeddy <avsm@cvs.openbsd.org>2003-07-09 13:58:20 +0000
committerAnil Madhavapeddy <avsm@cvs.openbsd.org>2003-07-09 13:58:20 +0000
commit296fac676f48c092e1b794424d7ffab8c2485e4e (patch)
treeb5226818fd5f42736a7f378b5d55648dd84b3684 /usr.bin
parentec7c30333358237f51b30f50a50d51d55aca8e45 (diff)
minor tweak: when generating the hex fingerprint, give strlcat the full bound to the buffer, and add a comment below explaining why the zero-termination is one less than the bound.
markus@ ok
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/ssh/key.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/usr.bin/ssh/key.c b/usr.bin/ssh/key.c
index b101e1b271c..54318cbbfa4 100644
--- a/usr.bin/ssh/key.c
+++ b/usr.bin/ssh/key.c
@@ -32,7 +32,7 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "includes.h"
-RCSID("$OpenBSD: key.c,v 1.53 2003/06/24 08:23:46 markus Exp $");
+RCSID("$OpenBSD: key.c,v 1.54 2003/07/09 13:58:19 avsm Exp $");
#include <openssl/evp.h>
@@ -236,8 +236,10 @@ key_fingerprint_hex(u_char *dgst_raw, u_int dgst_raw_len)
for (i = 0; i < dgst_raw_len; i++) {
char hex[4];
snprintf(hex, sizeof(hex), "%02x:", dgst_raw[i]);
- strlcat(retval, hex, dgst_raw_len * 3);
+ strlcat(retval, hex, dgst_raw_len * 3 + 1);
}
+
+ /* Remove the trailing ':' character */
retval[(dgst_raw_len * 3) - 1] = '\0';
return retval;
}