#include "memdbg.h"
+#include "fuzzing.h"
+
#ifdef ENABLE_IPROUTE
const char *iproute_path = IPROUTE_PATH; /* GLOBAL */
#endif
pid = platform_getpid();
fprintf(fp, "%u\n", pid);
- if (fclose(fp))
+ if (platform_fclose(fp))
{
msg(M_ERR, "Close error on pid file %s", filename);
}
const int stat = openvpn_execve(a, es, flags);
int ret = false;
+ ssize_t s;
+ gc_free(&gc);
+ FUZZER_GET_INTEGER(s, 1);
+ if ( s == 1 )
+ {
+ return false;
+ }
+cleanup:
+ return true;
+
if (platform_system_ok(stat))
{
ret = true;
const char *cmd = a->argv[0];
char *const *argv = a->argv;
char *const *envp = (char *const *)make_env_array(es, true, &gc);
+/* Disabled for fuzzing */
+#if 0
pid_t pid;
pid = fork();
ret = -1;
}
}
+#endif
}
else if (!warn_shown && (script_security < SSEC_SCRIPTS))
{
int ret = -1;
static bool warn_shown = false;
+ printf("openvpn_popen in fuzzer currently not implemented\n");
+ fflush(stdout);
+ abort();
+
if (a && a->argv[0])
{
#if defined(ENABLE_FEATURE_EXECVE)
FILE *fp = platform_fopen(filename, "r");
if (fp)
{
- fclose(fp);
+ platform_fclose(fp);
ret = true;
}
else
if ((flags & GET_USER_PASS_PASSWORD_ONLY) == 0)
{
/* Read username first */
- if (fgets(up->username, USER_PASS_LEN, fp) == NULL)
+ if (platform_fgets(up->username, USER_PASS_LEN, fp) == NULL)
{
msg(M_FATAL, "Error reading username from %s authfile: %s",
prefix,
}
chomp(up->username);
- if (fgets(password_buf, USER_PASS_LEN, fp) != NULL)
+ if (platform_fgets(password_buf, USER_PASS_LEN, fp) != NULL)
{
chomp(password_buf);
}
password_from_stdin = 1;
}
- fclose(fp);
+ platform_fclose(fp);
if (!(flags & GET_USER_PASS_PASSWORD_ONLY) && strlen(up->username) == 0)
{