summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Nordberg <linus@nordu.net>2011-04-05 15:26:53 +0200
committerLinus Nordberg <linus@nordu.net>2011-04-05 15:26:53 +0200
commit5042a29c4e80ca97fa51122954079d7d169037e9 (patch)
treed69ed5fea81811f226e4c8de5d4b25c3ef82e081
parentb23fcde92676758bb0447b1dad828fcacbbe0fd0 (diff)
Don't smash buffer on stack.
(format_hash): Don't write past OUT_LEN. Duh!
-rw-r--r--fticks.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fticks.c b/fticks.c
index 724a589..ce4888e 100644
--- a/fticks.c
+++ b/fticks.c
@@ -21,7 +21,7 @@ format_hash(const uint8_t *hash, size_t out_len, uint8_t *out)
{
int i;
- for (i = 0; i < out_len / 2; i++)
+ for (i = 0; i < out_len / 2 - 1; i++)
sprintf((char *) out + i*2, "%02x", hash[i % SHA256_DIGEST_SIZE]);
}