summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2012-07-19 20:59:13 +0200
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2012-07-19 20:59:55 +0200
commit24eaf24df6b82697ba6c24cb1bce973608efc35f (patch)
tree352b72d8900c3edd19ee485864cb718815a3d276
parente576e57600e67b3f7364807fd0d43b5fb9b02de5 (diff)
downloadgnutls-24eaf24df6b82697ba6c24cb1bce973608efc35f.tar.gz
Avoid the usage of alloca(). Reported by Rob McMahon.
-rw-r--r--tests/openpgp-auth.c6
-rw-r--r--tests/openpgp-auth2.c6
2 files changed, 8 insertions, 4 deletions
diff --git a/tests/openpgp-auth.c b/tests/openpgp-auth.c
index d3e521c415..503519aa4f 100644
--- a/tests/openpgp-auth.c
+++ b/tests/openpgp-auth.c
@@ -87,12 +87,12 @@ doit ()
if (err != 0)
fail ("socketpair %s\n", strerror (errno));
- pub_key_path = alloca (strlen (srcdir) + strlen (pub_key_file) + 2);
+ pub_key_path = malloc (strlen (srcdir) + strlen (pub_key_file) + 2);
strcpy (pub_key_path, srcdir);
strcat (pub_key_path, "/");
strcat (pub_key_path, pub_key_file);
- priv_key_path = alloca (strlen (srcdir) + strlen (priv_key_file) + 2);
+ priv_key_path = malloc (strlen (srcdir) + strlen (priv_key_file) + 2);
strcpy (priv_key_path, srcdir);
strcat (priv_key_path, "/");
strcat (priv_key_path, priv_key_file);
@@ -267,6 +267,8 @@ doit ()
}
+ free(pub_key_path);
+ free(priv_key_path);
gnutls_global_deinit ();
}
#else
diff --git a/tests/openpgp-auth2.c b/tests/openpgp-auth2.c
index 92253fd31f..8877df593f 100644
--- a/tests/openpgp-auth2.c
+++ b/tests/openpgp-auth2.c
@@ -86,12 +86,12 @@ doit ()
if (err != 0)
fail ("socketpair %s\n", strerror (errno));
- pub_key_path = alloca (strlen (srcdir) + strlen (pub_key_file) + 2);
+ pub_key_path = malloc (strlen (srcdir) + strlen (pub_key_file) + 2);
strcpy (pub_key_path, srcdir);
strcat (pub_key_path, "/");
strcat (pub_key_path, pub_key_file);
- priv_key_path = alloca (strlen (srcdir) + strlen (priv_key_file) + 2);
+ priv_key_path = malloc (strlen (srcdir) + strlen (priv_key_file) + 2);
strcpy (priv_key_path, srcdir);
strcat (priv_key_path, "/");
strcat (priv_key_path, priv_key_file);
@@ -250,6 +250,8 @@ doit ()
fail ("child failed: %d\n", status);
}
+ free(pub_key_path);
+ free(priv_key_path);
gnutls_global_deinit ();
}
#else