Skip to content

Commit 3983bf6

Browse files
committed
[libc] Fix GPU argument vector writing nullptr to string
Summary: The intention behind this code was to null terminate the `envp` string, but it accidentally went into the string data.
1 parent 5e6d5c0 commit 3983bf6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

libc/utils/gpu/loader/Loader.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ void *copy_argument_vector(int argc, const char **argv, Allocator alloc) {
8585
}
8686

8787
// Ensure the vector is null terminated.
88-
reinterpret_cast<void **>(dev_argv)[argv_size] = nullptr;
88+
reinterpret_cast<void **>(dev_argv)[argc + 1] = nullptr;
8989
return dev_argv;
9090
}
9191

0 commit comments

Comments
 (0)