Author: jerry
Date: 2006-09-27 03:43:42 +0000 (Wed, 27 Sep 2006)
New Revision: 18940

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

Log:
Fix a few memory corruption bugs to make CreateKey() and DeleteKey() work


Modified:
   branches/SAMBA_3_0/source/rpc_server/srv_winreg_nt.c


Changeset:
Modified: branches/SAMBA_3_0/source/rpc_server/srv_winreg_nt.c
===================================================================
--- branches/SAMBA_3_0/source/rpc_server/srv_winreg_nt.c        2006-09-27 
03:34:50 UTC (rev 18939)
+++ branches/SAMBA_3_0/source/rpc_server/srv_winreg_nt.c        2006-09-27 
03:43:42 UTC (rev 18940)
@@ -1189,7 +1189,9 @@
 
                /* 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 @@
                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 */

Reply via email to