acquire realpath from user input

This commit is contained in:
Felix Kratz 2023-03-22 16:53:51 +01:00
parent 2306e34172
commit e704e95d04

View file

@ -194,8 +194,14 @@ static void parse_arguments(int argc, char **argv) {
if (argc < 3) {
printf("[!] Error: Too few arguments for argument 'config'.\n");
} else {
snprintf(g_config_file, sizeof(g_config_file), "%s", argv[2]);
return;
char* path = realpath(argv[2], NULL);
if (path) {
snprintf(g_config_file, sizeof(g_config_file), "%s", path);
free(path);
return;
}
printf("[!] Error: Specified config file path invalid.\n");
}
exit(EXIT_FAILURE);
}