int err, i;
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 ();
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);
}
- free(pub_key_path);
- free(priv_key_path);
gnutls_global_deinit ();
}
#else
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 ();
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);
fail ("child failed: %d\n", status);
}
- free(pub_key_path);
- free(priv_key_path);
gnutls_global_deinit ();
}
#else