diff options
author | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2012-07-19 20:59:13 +0200 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2012-07-19 20:59:13 +0200 |
commit | 7af349a1f1f91baca8b7cae2ee3b53d9172bdaa7 (patch) | |
tree | f3f15ef1daa0325feb62539bec34c5cdf8b11810 /tests | |
parent | 673ae9f69ab57b1e161b92f102af4b0f21ffbdcc (diff) | |
download | gnutls-7af349a1f1f91baca8b7cae2ee3b53d9172bdaa7.tar.gz |
Avoid the usage of alloca(). Reported by Rob McMahon.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/openpgp-auth.c | 6 | ||||
-rw-r--r-- | tests/openpgp-auth2.c | 6 |
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 |