diff options
author | Darren Tucker <dtucker@zip.com.au> | 2003-07-14 17:28:34 +1000 |
---|---|---|
committer | Darren Tucker <dtucker@zip.com.au> | 2003-07-14 17:28:34 +1000 |
commit | 29588616c214e411e1823b2949e5fa9d6a49d75f (patch) | |
tree | 345c9c73283dc0d0b92e75383b1cecea37a602ba /key.c | |
parent | 0abf13bb504ae7361d0f5ed581398c7408b073f0 (diff) |
- avsm@cvs.openbsd.org 2003/07/09 13:58:19
[key.c]
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 'key.c')
-rw-r--r-- | key.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -32,7 +32,7 @@ | |||
32 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 32 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
33 | */ | 33 | */ |
34 | #include "includes.h" | 34 | #include "includes.h" |
35 | RCSID("$OpenBSD: key.c,v 1.53 2003/06/24 08:23:46 markus Exp $"); | 35 | RCSID("$OpenBSD: key.c,v 1.54 2003/07/09 13:58:19 avsm Exp $"); |
36 | 36 | ||
37 | #include <openssl/evp.h> | 37 | #include <openssl/evp.h> |
38 | 38 | ||
@@ -236,8 +236,10 @@ key_fingerprint_hex(u_char *dgst_raw, u_int dgst_raw_len) | |||
236 | for (i = 0; i < dgst_raw_len; i++) { | 236 | for (i = 0; i < dgst_raw_len; i++) { |
237 | char hex[4]; | 237 | char hex[4]; |
238 | snprintf(hex, sizeof(hex), "%02x:", dgst_raw[i]); | 238 | snprintf(hex, sizeof(hex), "%02x:", dgst_raw[i]); |
239 | strlcat(retval, hex, dgst_raw_len * 3); | 239 | strlcat(retval, hex, dgst_raw_len * 3 + 1); |
240 | } | 240 | } |
241 | |||
242 | /* Remove the trailing ':' character */ | ||
241 | retval[(dgst_raw_len * 3) - 1] = '\0'; | 243 | retval[(dgst_raw_len * 3) - 1] = '\0'; |
242 | return retval; | 244 | return retval; |
243 | } | 245 | } |