shithub: fingerd

Download patch

ref: cd993f01c6418a32db4632e88dbda5626e71a7ad
parent: 83e52dcb1e1099ae9ac735ac4fead6aa99693c79
author: sirjofri <[email protected]>
date: Tue Apr 27 11:03:25 EDT 2021

better \r\n handling, now accepts request without \r.

--- a/fingerd.c
+++ b/fingerd.c
@@ -124,14 +124,19 @@
 	} ARGEND
 
 	bin = Bfdopen(0, OREAD);
-	req = Brdline(bin, '\r');
+	req = Brdline(bin, '\n');
 	if (req == nil)
 		sysfatal("bad read: %r");
 	n = Blinelen(bin);
 	req[n-1] = 0;
+	n--;
+	if (req[n-1] == '\r'){
+		req[n-1] = 0;
+		n--;
+	}
 
 	switch(n){
-	case 1:  /* server request */
+	case 0:  /* server request */
 		if (!cat(motd, 0))
 			print("motd not found.\r\n");
 		if (puserlist)