svn commit: samba r8916 - branches/SAMBA_3_0/source/rpc_server trunk/source/rpc_server

jerry at samba.org jerry at samba.org
Tue Aug 2 07:26:31 GMT 2005


Author: jerry
Date: 2005-08-02 07:26:29 +0000 (Tue, 02 Aug 2005)
New Revision: 8916

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

Log:
should fix the valgrind invalid read of size 1 onthe
GetPrinterData("OSVersion") abartlet saw when browsing from 
Vista client.


Modified:
   branches/SAMBA_3_0/source/rpc_server/srv_spoolss_nt.c
   trunk/source/rpc_server/srv_spoolss_nt.c


Changeset:
Modified: branches/SAMBA_3_0/source/rpc_server/srv_spoolss_nt.c
===================================================================
--- branches/SAMBA_3_0/source/rpc_server/srv_spoolss_nt.c	2005-08-02 07:11:41 UTC (rev 8915)
+++ branches/SAMBA_3_0/source/rpc_server/srv_spoolss_nt.c	2005-08-02 07:26:29 UTC (rev 8916)
@@ -2283,7 +2283,7 @@
 		
 	if (!StrCaseCmp(value, "W3SvcInstalled")) {
 		*type = REG_DWORD;
-		if((*data = (uint8 *)TALLOC_ZERO(ctx, 4*sizeof(uint8) )) == NULL)
+		if ( !(*data = TALLOC_ARRAY(ctx, uint8, sizeof(uint32) )) )
 			return WERR_NOMEM;
 		*needed = 0x4;
 		return WERR_OK;
@@ -2291,7 +2291,7 @@
 
 	if (!StrCaseCmp(value, "BeepEnabled")) {
 		*type = REG_DWORD;
-		if((*data = (uint8 *)TALLOC(ctx, 4*sizeof(uint8) )) == NULL)
+		if ( !(*data = TALLOC_ARRAY(ctx, uint8, sizeof(uint32) )) )
 			return WERR_NOMEM;
 		SIVAL(*data, 0, 0x00);
 		*needed = 0x4;			
@@ -2300,7 +2300,7 @@
 
 	if (!StrCaseCmp(value, "EventLog")) {
 		*type = REG_DWORD;
-		if((*data = (uint8 *)TALLOC(ctx, 4 )) == NULL)
+		if ( !(*data = TALLOC_ARRAY(ctx, uint8, sizeof(uint32) )) )
 			return WERR_NOMEM;
 		/* formally was 0x1b */
 		SIVAL(*data, 0, 0x0);
@@ -2310,7 +2310,7 @@
 
 	if (!StrCaseCmp(value, "NetPopup")) {
 		*type = REG_DWORD;
-		if((*data = (uint8 *)TALLOC(ctx, 4 )) == NULL)
+		if ( !(*data = TALLOC_ARRAY(ctx, uint8, sizeof(uint32) )) )
 			return WERR_NOMEM;
 		SIVAL(*data, 0, 0x00);
 		*needed = 0x4;
@@ -2319,7 +2319,7 @@
 
 	if (!StrCaseCmp(value, "MajorVersion")) {
 		*type = REG_DWORD;
-		if((*data = (uint8 *)TALLOC(ctx, 4 )) == NULL)
+		if ( !(*data = TALLOC_ARRAY(ctx, uint8, sizeof(uint32) )) )
 			return WERR_NOMEM;
 
 		/* Windows NT 4.0 seems to not allow uploading of drivers
@@ -2338,7 +2338,7 @@
 
 	if (!StrCaseCmp(value, "MinorVersion")) {
 		*type = REG_DWORD;
-		if((*data = (uint8 *)TALLOC(ctx, 4 )) == NULL)
+		if ( !(*data = TALLOC_ARRAY(ctx, uint8, sizeof(uint32) )) )
 			return WERR_NOMEM;
 		SIVAL(*data, 0, 0);
 		*needed = 0x4;
@@ -2356,7 +2356,7 @@
 		*type = REG_BINARY;
 		*needed = 0x114;
 
-		if ( !(*data = TALLOC_ZERO_ARRAY(ctx, uint8, *needed)) )
+		if ( !(*data = TALLOC_ZERO_ARRAY(ctx, uint8, (*needed > in_size) ? *needed:in_size )) )
 			return WERR_NOMEM;
 
 		SIVAL(*data, 0, *needed);	/* size */
@@ -2402,7 +2402,7 @@
 
 	if (!StrCaseCmp(value, "DsPresent")) {
 		*type = REG_DWORD;
-		if((*data = (uint8 *)TALLOC(ctx, 4 )) == NULL)
+		if ( !(*data = TALLOC_ARRAY(ctx, uint8, sizeof(uint32) )) )
 			return WERR_NOMEM;
 
 		/* only show the publish check box if we are a 

Modified: trunk/source/rpc_server/srv_spoolss_nt.c
===================================================================
--- trunk/source/rpc_server/srv_spoolss_nt.c	2005-08-02 07:11:41 UTC (rev 8915)
+++ trunk/source/rpc_server/srv_spoolss_nt.c	2005-08-02 07:26:29 UTC (rev 8916)
@@ -2283,7 +2283,7 @@
 		
 	if (!StrCaseCmp(value, "W3SvcInstalled")) {
 		*type = REG_DWORD;
-		if((*data = (uint8 *)TALLOC_ZERO(ctx, 4*sizeof(uint8) )) == NULL)
+		if ( !(*data = TALLOC_ARRAY(ctx, uint8, sizeof(uint32) )) )
 			return WERR_NOMEM;
 		*needed = 0x4;
 		return WERR_OK;
@@ -2291,7 +2291,7 @@
 
 	if (!StrCaseCmp(value, "BeepEnabled")) {
 		*type = REG_DWORD;
-		if((*data = (uint8 *)TALLOC(ctx, 4*sizeof(uint8) )) == NULL)
+		if ( !(*data = TALLOC_ARRAY(ctx, uint8, sizeof(uint32) )) )
 			return WERR_NOMEM;
 		SIVAL(*data, 0, 0x00);
 		*needed = 0x4;			
@@ -2300,7 +2300,7 @@
 
 	if (!StrCaseCmp(value, "EventLog")) {
 		*type = REG_DWORD;
-		if((*data = (uint8 *)TALLOC(ctx, 4 )) == NULL)
+		if ( !(*data = TALLOC_ARRAY(ctx, uint8, sizeof(uint32) )) )
 			return WERR_NOMEM;
 		/* formally was 0x1b */
 		SIVAL(*data, 0, 0x0);
@@ -2310,7 +2310,7 @@
 
 	if (!StrCaseCmp(value, "NetPopup")) {
 		*type = REG_DWORD;
-		if((*data = (uint8 *)TALLOC(ctx, 4 )) == NULL)
+		if ( !(*data = TALLOC_ARRAY(ctx, uint8, sizeof(uint32) )) )
 			return WERR_NOMEM;
 		SIVAL(*data, 0, 0x00);
 		*needed = 0x4;
@@ -2319,7 +2319,7 @@
 
 	if (!StrCaseCmp(value, "MajorVersion")) {
 		*type = REG_DWORD;
-		if((*data = (uint8 *)TALLOC(ctx, 4 )) == NULL)
+		if ( !(*data = TALLOC_ARRAY(ctx, uint8, sizeof(uint32) )) )
 			return WERR_NOMEM;
 
 		/* Windows NT 4.0 seems to not allow uploading of drivers
@@ -2338,7 +2338,7 @@
 
 	if (!StrCaseCmp(value, "MinorVersion")) {
 		*type = REG_DWORD;
-		if((*data = (uint8 *)TALLOC(ctx, 4 )) == NULL)
+		if ( !(*data = TALLOC_ARRAY(ctx, uint8, sizeof(uint32) )) )
 			return WERR_NOMEM;
 		SIVAL(*data, 0, 0);
 		*needed = 0x4;
@@ -2356,7 +2356,7 @@
 		*type = REG_BINARY;
 		*needed = 0x114;
 
-		if ( !(*data = TALLOC_ZERO_ARRAY(ctx, uint8, *needed)) )
+		if ( !(*data = TALLOC_ZERO_ARRAY(ctx, uint8, (*needed > in_size) ? *needed:in_size )) )
 			return WERR_NOMEM;
 
 		SIVAL(*data, 0, *needed);	/* size */
@@ -2402,7 +2402,7 @@
 
 	if (!StrCaseCmp(value, "DsPresent")) {
 		*type = REG_DWORD;
-		if((*data = (uint8 *)TALLOC(ctx, 4 )) == NULL)
+		if ( !(*data = TALLOC_ARRAY(ctx, uint8, sizeof(uint32) )) )
 			return WERR_NOMEM;
 
 		/* only show the publish check box if we are a 



More information about the samba-cvs mailing list