summaryrefslogtreecommitdiff
path: root/sexp.c
diff options
context:
space:
mode:
authorNiels Möller <nisse@lysator.liu.se>2004-01-08 13:37:13 +0100
committerNiels Möller <nisse@lysator.liu.se>2004-01-08 13:37:13 +0100
commit21ee1904b5c46f314b862eea33d3b86fcf6c7c88 (patch)
tree87460c8b18c74f6b20f94bac8e3cc1b378a6215f /sexp.c
parentdcd5b982b7323a3834bbf43019dd8b30df7e71e4 (diff)
downloadnettle-21ee1904b5c46f314b862eea33d3b86fcf6c7c88.tar.gz
(TMP_DECL, TMP_ALLOC): New macros. When alloca is unavailable, they
work by allocating a fix amount of stack and imposing a hard limit on what can be allocated. Updated all users of alloca. Rev: src/nettle/bignum-random.c:1.4 Rev: src/nettle/cbc.c:1.8 Rev: src/nettle/dsa-keygen.c:1.7 Rev: src/nettle/hmac.c:1.6 Rev: src/nettle/pkcs1-rsa-md5.c:1.3 Rev: src/nettle/pkcs1-rsa-sha1.c:1.3 Rev: src/nettle/rsa-decrypt.c:1.5 Rev: src/nettle/rsa-encrypt.c:1.8 Rev: src/nettle/sexp.c:1.15
Diffstat (limited to 'sexp.c')
-rw-r--r--sexp.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/sexp.c b/sexp.c
index e6dce172..10992821 100644
--- a/sexp.c
+++ b/sexp.c
@@ -33,6 +33,7 @@
#include "sexp.h"
#include "macros.h"
+#include "nettle-internal.h"
/* Initializes the iterator, but one has to call next to get to the
* first element. */
@@ -324,11 +325,11 @@ sexp_iterator_assoc(struct sexp_iterator *iterator,
const uint8_t **keys,
struct sexp_iterator *values)
{
- int *found;
+ TMP_DECL(found, int, NETTLE_MAX_SEXP_ASSOC);
unsigned nfound;
unsigned i;
-
- found = alloca(nkeys * sizeof(*found));
+
+ TMP_ALLOC(found, nkeys);
for (i = 0; i<nkeys; i++)
found[i] = 0;