shithub: riscv

Download patch

ref: 51eaebf4f01ce8b8de4e32d679fe98b69ae64ad0
parent: f00488ec70c0ca00396d3d3e47b38285599dd31a
author: cinap_lenrek <[email protected]>
date: Sat Apr 29 12:25:48 EDT 2017

sshfs: don't crash when no /etc/password file could be read on the remote side

in a cygwin environment, theres no /etc/passwd file to
translate numeric uid/gid's. changing passwdparse() to
ignore nil string argument.

--- a/sys/src/cmd/sshfs.c
+++ b/sys/src/cmd/sshfs.c
@@ -1252,13 +1252,13 @@
 void
 passwdparse(IDEnt **tab, char *s)
 {
-	char *p;
-	char *n;
-	int id;
 	IDEnt *e, **b;
+	char *p, *n;
+	int id;
 
-	p = s;
-	for(;;){
+	if(s == nil)
+		return;
+	for(p = s;;){
 		n = p;
 		p = strpbrk(p, ":\n"); if(p == nil) break; if(*p != ':'){ p++; continue; }
 		*p = 0;