From e3010f2d6dfc022312e86e82f3cf75dfd1b970c8 Mon Sep 17 00:00:00 2001
From: Přemysl Janouch
Date: Fri, 8 Aug 2014 10:52:08 +0200
Subject: kike: fix fingerprint generation and checking
---
src/kike.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/kike.c b/src/kike.c
index 3202333..dde8d42 100644
--- a/src/kike.c
+++ b/src/kike.c
@@ -227,7 +227,7 @@ irc_is_valid_key (const char *key)
static bool
irc_is_valid_fingerprint (const char *fp)
{
- return irc_regex_match ("^[a-fA-F0-9]{2}(:[a-fA-F0-9]{2}){20}$", fp);
+ return irc_regex_match ("^[a-fA-F0-9]{2}(:[a-fA-F0-9]{2}){19}$", fp);
}
// --- Application data --------------------------------------------------------
@@ -798,7 +798,7 @@ client_get_ssl_cert_fingerprint (struct client *c)
struct str fingerprint;
str_init (&fingerprint);
str_append_printf (&fingerprint, "%02X", hash[0]);
- for (size_t i = 0; i < sizeof hash; i++)
+ for (size_t i = 1; i < sizeof hash; i++)
str_append_printf (&fingerprint, ":%02X", hash[i]);
return str_steal (&fingerprint);
}
--
cgit v1.2.3-70-g09d2