svn commit: samba r16246 - in trunk/source/lib: .

jra at samba.org jra at samba.org
Thu Jun 15 05:32:26 GMT 2006


Author: jra
Date: 2006-06-15 05:32:24 +0000 (Thu, 15 Jun 2006)
New Revision: 16246

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

Log:
Cope with string being zero len. Klocwork bug #410.
Jeremy.

Modified:
   trunk/source/lib/getsmbpass.c


Changeset:
Modified: trunk/source/lib/getsmbpass.c
===================================================================
--- trunk/source/lib/getsmbpass.c	2006-06-15 05:32:21 UTC (rev 16245)
+++ trunk/source/lib/getsmbpass.c	2006-06-15 05:32:24 UTC (rev 16246)
@@ -147,8 +147,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