void test_symlink(const char *path)
{
	char *d = strdupa(path), *tmpname;
	d = dirname(d);
	size_t len = strlen(path) + 30;
	tmpname = alloca(len);
	snprintf(tmpname, len, "%s/%d", d, (int)getpid());

	if (symlink(tmpname, path) == 0) {
		fprintf(stderr, "leak at symlink of %s\n", path);
		exit(1);
	}
	if (errno != ENOENT && errno != ENOSYS) {
		fprintf(stderr, "leak at symlink of %s: errno was %s\n", path, strerror(errno));
		exit(1);
	}
	if (symlink(path, tmpname) == 0) {
		fprintf(stderr, "leak at symlink (2) of %s\n", path);
		exit(1);
	}
	if (errno != ENOENT && errno != ENOSYS) {
		fprintf(stderr, "leak at symlink (2) of %s: errno was %s\n", path, strerror(errno));
		exit(1);
	}
}
Weaknesses in this category are related to the management of permissions, privileges, and other security features that are used to perform access control.