svn commit: samba r17869 - in branches: SAMBA_3_0/source/lib SAMBA_3_0_23/source/lib

jra at samba.org jra at samba.org
Mon Aug 28 03:15:07 GMT 2006


Author: jra
Date: 2006-08-28 03:15:06 +0000 (Mon, 28 Aug 2006)
New Revision: 17869

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

Log:
More sensible fix for Stanford Checker null deref.
Jeremy.

Modified:
   branches/SAMBA_3_0/source/lib/xfile.c
   branches/SAMBA_3_0_23/source/lib/xfile.c


Changeset:
Modified: branches/SAMBA_3_0/source/lib/xfile.c
===================================================================
--- branches/SAMBA_3_0/source/lib/xfile.c	2006-08-28 02:57:54 UTC (rev 17868)
+++ branches/SAMBA_3_0/source/lib/xfile.c	2006-08-28 03:15:06 UTC (rev 17869)
@@ -259,7 +259,7 @@
 		return -1;
 	}
 
-	if (f->bufused == 0) return 0;
+	if (f->bufused == 0 || !f->buf) return 0;
 
 	ret = write(f->fd, f->buf, f->bufused);
 	if (ret == -1) return -1;
@@ -267,9 +267,7 @@
 	f->bufused -= ret;
 	if (f->bufused > 0) {
 		f->flags |= X_FLAG_ERROR;
-		if (f->buf) {
-			memmove(f->buf, ret + (char *)f->buf, f->bufused);
-		}
+		memmove(f->buf, ret + (char *)f->buf, f->bufused);
 		return -1;
 	}
 

Modified: branches/SAMBA_3_0_23/source/lib/xfile.c
===================================================================
--- branches/SAMBA_3_0_23/source/lib/xfile.c	2006-08-28 02:57:54 UTC (rev 17868)
+++ branches/SAMBA_3_0_23/source/lib/xfile.c	2006-08-28 03:15:06 UTC (rev 17869)
@@ -259,7 +259,7 @@
 		return -1;
 	}
 
-	if (f->bufused == 0) return 0;
+	if (f->bufused == 0 || !f->buf) return 0;
 
 	ret = write(f->fd, f->buf, f->bufused);
 	if (ret == -1) return -1;
@@ -267,9 +267,7 @@
 	f->bufused -= ret;
 	if (f->bufused > 0) {
 		f->flags |= X_FLAG_ERROR;
-		if (f->buf) {
-			memmove(f->buf, ret + (char *)f->buf, f->bufused);
-		}
+		memmove(f->buf, ret + (char *)f->buf, f->bufused);
 		return -1;
 	}
 



More information about the samba-cvs mailing list