Skip to content

Commit d3fe24d

Browse files
committed
exec_callback: fix check for TERMUX_EXPORT_FD env var
Can't strncmp it without checking if it is null first.
1 parent 45af271 commit d3fe24d

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

termux-api.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ _Noreturn void exec_callback(int fd)
8585

8686
char errmsg[256];
8787
char *export_to_env = getenv("TERMUX_EXPORT_FD");
88-
if (strncmp(export_to_env, "true", 4) == 0) {
88+
if (export_to_env && strncmp(export_to_env, "true", 4) == 0) {
8989
if (setenv("TERMUX_USB_FD", fds, true) == -1)
9090
perror("setenv");
9191
execl(callback_fun, callback_fun, NULL);

0 commit comments

Comments
 (0)