summaryrefslogtreecommitdiff
path: root/tests/openpgp-auth2.c
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2012-07-21 14:14:53 +0200
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2012-07-21 14:14:53 +0200
commit9cda828053a6a0878535963f81a7fc1f772d8b59 (patch)
tree70886b5511b09d58ced100f49d72af88a19275e1 /tests/openpgp-auth2.c
parent83155cf54ac3983bcefa93a451b038b625e9a357 (diff)
downloadgnutls-9cda828053a6a0878535963f81a7fc1f772d8b59.tar.gz
use stack for file paths
Diffstat (limited to 'tests/openpgp-auth2.c')
-rw-r--r--tests/openpgp-auth2.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/tests/openpgp-auth2.c b/tests/openpgp-auth2.c
index 8877df593f..79a7ad9bef 100644
--- a/tests/openpgp-auth2.c
+++ b/tests/openpgp-auth2.c
@@ -69,7 +69,7 @@ doit ()
int err;
int sockets[2];
const char *srcdir;
- char *pub_key_path, *priv_key_path;
+ char pub_key_path[512], priv_key_path[512];
pid_t child;
gnutls_global_init ();
@@ -86,12 +86,16 @@ doit ()
if (err != 0)
fail ("socketpair %s\n", strerror (errno));
- pub_key_path = malloc (strlen (srcdir) + strlen (pub_key_file) + 2);
+ if (sizeof(pub_key_path) < strlen (srcdir) + strlen (pub_key_file) + 2)
+ abort();
+
strcpy (pub_key_path, srcdir);
strcat (pub_key_path, "/");
strcat (pub_key_path, pub_key_file);
- priv_key_path = malloc (strlen (srcdir) + strlen (priv_key_file) + 2);
+ if (sizeof(priv_key_path) < strlen (srcdir) + strlen (priv_key_file) + 2)
+ abort();
+
strcpy (priv_key_path, srcdir);
strcat (priv_key_path, "/");
strcat (priv_key_path, priv_key_file);
@@ -250,8 +254,6 @@ doit ()
fail ("child failed: %d\n", status);
}
- free(pub_key_path);
- free(priv_key_path);
gnutls_global_deinit ();
}
#else