From de5c0855acbd00f78504e8713afa139763ffb6e2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Niels=20M=C3=B6ller?= <nisse@lysator.liu.se>
Date: Sat, 7 Feb 2004 13:35:44 +0100
Subject: [PATCH] (sexp_put_digest): Use TMP_DECL instead of alloca.

Rev: src/nettle/tools/output.c:1.4
---
 tools/output.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/tools/output.c b/tools/output.c
index d9735f5c..4d5a5743 100644
--- a/tools/output.c
+++ b/tools/output.c
@@ -32,6 +32,9 @@
 
 #include "output.h"
 
+/* For TMP_ALLOC */ 
+#include "nettle-internal.h"
+
 void
 sexp_output_init(struct sexp_output *output, FILE *f,
 		 unsigned width, int prefer_hex)
@@ -268,11 +271,11 @@ sexp_put_string(struct sexp_output *output, enum sexp_mode mode,
 void
 sexp_put_digest(struct sexp_output *output)
 {
-  uint8_t *digest;
+  TMP_DECL(digest, uint8_t, NETTLE_MAX_HASH_DIGEST_SIZE);
+  TMP_ALLOC(digest, output->hash->digest_size);
   
   assert(output->hash);
 
-  digest = alloca(output->hash->digest_size);
   output->hash->digest(output->ctx, output->hash->digest_size, digest);
 
   sexp_put_code_start(output, &nettle_base16);
-- 
GitLab