svn commit: samba r25681 - in branches/SAMBA_4_0/source/lib/replace: .

metze at samba.org metze at samba.org
Wed Oct 17 14:00:59 GMT 2007


Author: metze
Date: 2007-10-17 14:00:57 +0000 (Wed, 17 Oct 2007)
New Revision: 25681

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=25681

Log:
r16245: Cope with string being zero len. Klocwork bug #410. Jeremy.
(cherry picked from commit 46c12de07fe6f44bcf58ca9de276e7932384843d)

Modified:
   branches/SAMBA_4_0/source/lib/replace/getpass.c


Changeset:
Modified: branches/SAMBA_4_0/source/lib/replace/getpass.c
===================================================================
--- branches/SAMBA_4_0/source/lib/replace/getpass.c	2007-10-17 14:00:42 UTC (rev 25680)
+++ branches/SAMBA_4_0/source/lib/replace/getpass.c	2007-10-17 14:00:57 UTC (rev 25681)
@@ -202,8 +202,10 @@
 		fgets(buf, bufsize, in);
 	}
 	nread = strlen(buf);
-	if (buf[nread - 1] == '\n')
-		buf[nread - 1] = '\0';
+	if (nread) {
+		if (buf[nread - 1] == '\n')
+			buf[nread - 1] = '\0';
+	}
 
 	/* Restore echoing.  */
 	if (echo_off) {



More information about the samba-cvs mailing list