OSDN Git Service

Fix the segmentation fault of ssh, and configure scp to make it work properly pie-x86 android-x86-9.0-r2
authorelliott10 <xiaoluoyuan@163.com>
Fri, 10 Aug 2018 07:24:39 +0000 (07:24 +0000)
committerChih-Wei Huang <cwhuang@linux.org.tw>
Mon, 16 Mar 2020 10:30:45 +0000 (18:30 +0800)
config.h
misc.c

index aeb2663..afdf3ed 100644 (file)
--- a/config.h
+++ b/config.h
 
 #define _PATH_PRIVSEP_CHROOT_DIR SSHDIR "/empty"
 
-#define _PATH_SSH_PROGRAM "/system/bin/sftp"
+#define _PATH_SSH_PROGRAM "/system/bin/ssh"
diff --git a/misc.c b/misc.c
index cfd3272..f71bebb 100644 (file)
--- a/misc.c
+++ b/misc.c
@@ -208,7 +208,10 @@ pwcopy(struct passwd *pw)
        struct passwd *copy = xcalloc(1, sizeof(*copy));
 
        copy->pw_name = xstrdup(pw->pw_name);
-       copy->pw_passwd = xstrdup(pw->pw_passwd);
+       /* Android does not do passwords and passes NULL for them. This breaks strlen */
+       if (pw->pw_passwd) {
+               copy->pw_passwd = xstrdup(pw->pw_passwd);
+       }
 #ifdef HAVE_STRUCT_PASSWD_PW_GECOS
        copy->pw_gecos = xstrdup(pw->pw_gecos);
 #endif