summaryrefslogtreecommitdiff
path: root/source3/rpc_server
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2006-09-27 03:43:42 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:14:49 -0500
commitd89a951517744c523d26af5e0e71d70fcc9f643b (patch)
tree2c9552767166f9bafcac22d194f5d68b3eaee7e3 /source3/rpc_server
parent0cc2cee8d5ccd95cd4cd10a060e2b3e703b6fba1 (diff)
downloadsamba-d89a951517744c523d26af5e0e71d70fcc9f643b.tar.gz
samba-d89a951517744c523d26af5e0e71d70fcc9f643b.tar.bz2
samba-d89a951517744c523d26af5e0e71d70fcc9f643b.zip
r18940: Fix a few memory corruption bugs to make CreateKey() and DeleteKey() work
(This used to be commit e7e3e35c1def29430dc69d3311d5779575659ec5)
Diffstat (limited to 'source3/rpc_server')
-rw-r--r--source3/rpc_server/srv_winreg_nt.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/source3/rpc_server/srv_winreg_nt.c b/source3/rpc_server/srv_winreg_nt.c
index cb2c795679..03320b38f6 100644
--- a/source3/rpc_server/srv_winreg_nt.c
+++ b/source3/rpc_server/srv_winreg_nt.c
@@ -1189,7 +1189,9 @@ WERROR _winreg_CreateKey( pipes_struct *p, struct policy_handle *handle, struct
/* copy the new key name (just the lower most keyname) */
- pstrcpy( name, ptr+1 );
+ if ( (name = talloc_strdup( p->mem_ctx, ptr+1 )) == NULL ) {
+ return WERR_NOMEM;
+ }
}
else {
/* use the existing open key information */
@@ -1334,11 +1336,15 @@ WERROR _winreg_DeleteKey(pipes_struct *p, struct policy_handle *handle, struct w
pstrcpy( newkeyname, name );
ptr = strrchr( newkeyname, '\\' );
*ptr = '\0';
- pstrcpy( name, ptr+1 );
+ if ( (name = talloc_strdup( p->mem_ctx, ptr+1 )) == NULL ) {
+ result = WERR_NOMEM;
+ goto done;
+ }
result = open_registry_key( p, &newparent_handle, &newparentinfo, parent, newkeyname, (REG_KEY_READ|REG_KEY_WRITE) );
- if ( !W_ERROR_IS_OK(result) )
- return result;
+ if ( !W_ERROR_IS_OK(result) ) {
+ goto done;
+ }
}
else {
/* use the existing open key information */