diff options
Diffstat (limited to 'internal/namespace/launcher_src/launcher.c')
| -rw-r--r-- | internal/namespace/launcher_src/launcher.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/internal/namespace/launcher_src/launcher.c b/internal/namespace/launcher_src/launcher.c index 60c6558..3f1b919 100644 --- a/internal/namespace/launcher_src/launcher.c +++ b/internal/namespace/launcher_src/launcher.c @@ -16,7 +16,14 @@ int main(int argc, char **argv) { // Check if we are joining an existing namespace char *join_pid_str = getenv("WG_WRAP_JOIN_PID"); if (join_pid_str != NULL && strlen(join_pid_str) > 0) { - int target_pid = atoi(join_pid_str); + char *endptr; + long target_pid = strtol(join_pid_str, &endptr, 10); + + if (*endptr != '\0' || target_pid <= 0) { + fprintf(stderr, "Invalid WG_WRAP_JOIN_PID: %s\n", join_pid_str); + return 1; + } + if (target_pid > 0) { char path[128]; int fd; |
