mirror of
https://github.com/samba-team/samba.git
synced 2024-12-22 13:34:15 +03:00
r18940: Fix a few memory corruption bugs to make CreateKey() and DeleteKey() work
(This used to be commit e7e3e35c1d
)
This commit is contained in:
parent
0cc2cee8d5
commit
d89a951517
@ -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 */
|
||||
|
Loading…
Reference in New Issue
Block a user