svn commit: samba r16245 - in branches/SAMBA_3_0/source/lib: .

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


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

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

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

Modified:
   branches/SAMBA_3_0/source/lib/getsmbpass.c


Changeset:
Modified: branches/SAMBA_3_0/source/lib/getsmbpass.c
===================================================================
--- branches/SAMBA_3_0/source/lib/getsmbpass.c	2006-06-15 05:20:22 UTC (rev 16244)
+++ branches/SAMBA_3_0/source/lib/getsmbpass.c	2006-06-15 05:32:21 UTC (rev 16245)
@@ -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