svn commit: samba r16602 - in trunk/source/registry: .

jra at samba.org jra at samba.org
Wed Jun 28 02:22:25 GMT 2006


Author: jra
Date: 2006-06-28 02:22:24 +0000 (Wed, 28 Jun 2006)
New Revision: 16602

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

Log:
Klockwork #2028. Fix null deref on error path.
Jeremy.

Modified:
   trunk/source/registry/reg_printing.c


Changeset:
Modified: trunk/source/registry/reg_printing.c
===================================================================
--- trunk/source/registry/reg_printing.c	2006-06-28 02:12:53 UTC (rev 16601)
+++ trunk/source/registry/reg_printing.c	2006-06-28 02:22:24 UTC (rev 16602)
@@ -225,7 +225,9 @@
 
 	/* get information for a specific printer */
 	
-	reg_split_path( printers_key, &printername, &printerdatakey );
+	if (!reg_split_path( printers_key, &printername, &printerdatakey )) {
+		return -1;
+	}
 
 	/* validate the printer name */
 
@@ -314,7 +316,9 @@
 		return add_printers_by_registry( subkeys );
 	}
 	
-	reg_split_path( printers_key, &printername, &printerdatakey );
+	if (!reg_split_path( printers_key, &printername, &printerdatakey )) {
+		return False;
+	}
 	
 	/* lookup the printer */
 	
@@ -482,7 +486,10 @@
 	
 	/* lookup the printer object */
 	
-	reg_split_path( printers_key, &printername, &printerdatakey );
+	if (!reg_split_path( printers_key, &printername, &printerdatakey )) {
+		return -1;
+	}
+	
 	if ( !W_ERROR_IS_OK( get_a_printer(NULL, &printer, 2, printername) ) )
 		goto done;
 		
@@ -672,7 +679,9 @@
 		return regdb_store_values( KEY_WINNT_PRINTERS, values );
 	}
 	
-	reg_split_path( printers_key, &printername, &keyname );
+	if (!reg_split_path( printers_key, &printername, &keyname )) {
+		return False;
+	}
 
 	if ( !W_ERROR_IS_OK(get_a_printer(NULL, &printer, 2, printername) ) )
 		return False;
@@ -754,7 +763,9 @@
 	
 	pstrcpy( key2, keystr );
 	keystr = key2;
-	reg_split_path( keystr, &base, &subkeypath );
+	if (!reg_split_path( keystr, &base, &subkeypath )) {
+		return -1;
+	}
 	
 	/* sanity check */
 	
@@ -777,7 +788,9 @@
 	/* more of the key path to process */
 	
 	keystr = subkeypath;
-	reg_split_path( keystr, &base, &subkeypath );	
+	if (!reg_split_path( keystr, &base, &subkeypath )) {
+		return -1;
+	}
 		
 	/* ...\Print\Environements\...\Drivers\ */
 	
@@ -809,7 +822,9 @@
 
 	if ( strequal(base, "Print Processors") ) {
 		keystr = subkeypath;
-		reg_split_path( keystr, &base, &subkeypath );
+		if (!reg_split_path( keystr, &base, &subkeypath )) {
+			return -1;
+		}
 
 		/* no subkeys below this point */
 
@@ -824,7 +839,10 @@
 	/* only dealing with drivers from here on out */
 
 	keystr = subkeypath;
-	reg_split_path( keystr, &base, &subkeypath );
+	if (!reg_split_path( keystr, &base, &subkeypath )) {
+		return -1;
+	}
+
 	version = atoi(&base[strlen(base)-1]);
 			
 	switch (env_index) {
@@ -947,7 +965,9 @@
 	NT_PRINTER_DRIVER_INFO_LEVEL	driver_ctr;
 	WERROR		w_result;
 
-	reg_split_path( key, &base, &subkeypath );
+	if (!reg_split_path( key, &base, &subkeypath )) {
+		return -1;
+	}
 	
 	/* no values in 'Environments\Drivers\Windows NT x86' */
 	
@@ -964,7 +984,9 @@
 	fstrcpy( arch_environment, base );
 	
 	keystr = subkeypath;
-	reg_split_path( keystr, &base, &subkeypath );
+	if (!reg_split_path( keystr, &base, &subkeypath )) {
+		return -1;
+	}
 
 	if ( strequal(base, "Print Processors") )
 		return 0;
@@ -981,7 +1003,9 @@
 	   The subkey name has to be Version-XX */
 	
 	keystr = subkeypath;
-	reg_split_path( keystr, &base, &subkeypath );
+	if (!reg_split_path( keystr, &base, &subkeypath )) {
+		return -1;
+	}
 
 	if ( !subkeypath )
 		return 0;
@@ -991,7 +1015,9 @@
 	/* BEGIN PRINTER DRIVER NAME BLOCK */
 	
 	keystr = subkeypath;
-	reg_split_path( keystr, &base, &subkeypath );
+	if (!reg_split_path( keystr, &base, &subkeypath )) {
+		return -1;
+	}
 	
 	/* don't go any deeper for now */
 	



More information about the samba-cvs mailing list