svn commit: samba r9321 - in branches/SAMBA_4_0/source/smb_server: .

ab at samba.org ab at samba.org
Tue Aug 16 13:22:02 GMT 2005


Author: ab
Date: 2005-08-16 13:22:01 +0000 (Tue, 16 Aug 2005)
New Revision: 9321

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

Log:
Fix potential bug found by Coverity. src_len has to be int but later we do pass it as size_t. In case src_len is negative, we need to register a failure and return to the caller
Modified:
   branches/SAMBA_4_0/source/smb_server/request.c


Changeset:
Modified: branches/SAMBA_4_0/source/smb_server/request.c
===================================================================
--- branches/SAMBA_4_0/source/smb_server/request.c	2005-08-16 10:57:21 UTC (rev 9320)
+++ branches/SAMBA_4_0/source/smb_server/request.c	2005-08-16 13:22:01 UTC (rev 9321)
@@ -491,16 +491,16 @@
 		src_len = byte_len;
 	} else {
 		src_len = req->in.data_size - PTR_DIFF(src, req->in.data);
-		if (src_len < 0) {
-			*dest = NULL;
-			return 0;
-		}
-
 		if (byte_len != -1 && src_len > byte_len) {
 			src_len = byte_len;
 		}
 	}
 
+	if (src_len < 0) {
+		*dest = NULL;
+		return 0;
+	}
+	
 	src_len2 = utf16_len_n(src, src_len);
 	if (src_len2 == 0) {
 		*dest = talloc_strdup(req, "");



More information about the samba-cvs mailing list