summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2006-06-28 02:22:28 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 11:19:03 -0500
commit5fb4cc9dff3c27c98ec4390d1a1836a3ea9373c2 (patch)
tree8a3213cc1b8a82395aff51c5cb6fc831e668b293 /source3
parent107698dd0e9b53e41003b677fef20f726a8a4ed6 (diff)
downloadsamba-5fb4cc9dff3c27c98ec4390d1a1836a3ea9373c2.tar.gz
samba-5fb4cc9dff3c27c98ec4390d1a1836a3ea9373c2.tar.bz2
samba-5fb4cc9dff3c27c98ec4390d1a1836a3ea9373c2.zip
r16603: Klockwork #2028. Fix null deref on error path.
Jeremy. (This used to be commit 067feef34388e93ded8db7fd3b4a6a4b752a3059)
Diffstat (limited to 'source3')
-rw-r--r--source3/registry/reg_printing.c50
1 files changed, 38 insertions, 12 deletions
diff --git a/source3/registry/reg_printing.c b/source3/registry/reg_printing.c
index a712a7c970..3ecff3d696 100644
--- a/source3/registry/reg_printing.c
+++ b/source3/registry/reg_printing.c
@@ -225,7 +225,9 @@ static int key_printers_fetch_keys( const char *key, REGSUBKEY_CTR *subkeys )
/* 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 @@ static BOOL key_printers_store_keys( const char *key, REGSUBKEY_CTR *subkeys )
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 @@ static int key_printers_fetch_values( const char *key, REGVAL_CTR *values )
/* 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 @@ static BOOL key_printers_store_values( const char *key, REGVAL_CTR *values )
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 @@ static int key_driver_fetch_keys( const char *key, REGSUBKEY_CTR *subkeys )
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 @@ static int key_driver_fetch_keys( const char *key, REGSUBKEY_CTR *subkeys )
/* 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 @@ static int key_driver_fetch_keys( const char *key, REGSUBKEY_CTR *subkeys )
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 @@ static int key_driver_fetch_keys( const char *key, REGSUBKEY_CTR *subkeys )
/* 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 @@ static int driver_arch_fetch_values( char *key, REGVAL_CTR *values )
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 @@ static int driver_arch_fetch_values( char *key, REGVAL_CTR *values )
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 @@ static int driver_arch_fetch_values( char *key, REGVAL_CTR *values )
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 @@ static int driver_arch_fetch_values( char *key, REGVAL_CTR *values )
/* 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 */