svn commit: samba r14353 - in branches/SAMBA_3_0/source: include
rpc_server
jra at samba.org
jra at samba.org
Mon Mar 13 23:07:16 GMT 2006
Author: jra
Date: 2006-03-13 23:07:14 +0000 (Mon, 13 Mar 2006)
New Revision: 14353
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=14353
Log:
Fix coverity bugs #61 and #62. Remember to divide by
the size of the data table. Clean up the struct a little.
Jeremy.
Modified:
branches/SAMBA_3_0/source/include/rpc_spoolss.h
branches/SAMBA_3_0/source/rpc_server/srv_spoolss_nt.c
Changeset:
Modified: branches/SAMBA_3_0/source/include/rpc_spoolss.h
===================================================================
--- branches/SAMBA_3_0/source/include/rpc_spoolss.h 2006-03-13 22:50:02 UTC (rev 14352)
+++ branches/SAMBA_3_0/source/include/rpc_spoolss.h 2006-03-13 23:07:14 UTC (rev 14353)
@@ -810,7 +810,7 @@
}
notify_data;
uint32 size;
- BOOL enc_type;
+ uint32 enc_type;
} SPOOL_NOTIFY_INFO_DATA;
typedef struct spool_notify_info
Modified: branches/SAMBA_3_0/source/rpc_server/srv_spoolss_nt.c
===================================================================
--- branches/SAMBA_3_0/source/rpc_server/srv_spoolss_nt.c 2006-03-13 22:50:02 UTC (rev 14352)
+++ branches/SAMBA_3_0/source/rpc_server/srv_spoolss_nt.c 2006-03-13 23:07:14 UTC (rev 14353)
@@ -3441,25 +3441,22 @@
{
int i=0;
- for (i = 0; i < sizeof(notify_info_data_table); i++)
- {
+ for (i = 0; i < (sizeof(notify_info_data_table)/sizeof(struct s_notify_info_data_table)); i++) {
if ( (notify_info_data_table[i].type == type)
- && (notify_info_data_table[i].field == field) )
- {
- switch(notify_info_data_table[i].size)
- {
- case NOTIFY_ONE_VALUE:
- case NOTIFY_TWO_VALUE:
- return 1;
- case NOTIFY_STRING:
- return 2;
+ && (notify_info_data_table[i].field == field) ) {
+ switch(notify_info_data_table[i].size) {
+ case NOTIFY_ONE_VALUE:
+ case NOTIFY_TWO_VALUE:
+ return 1;
+ case NOTIFY_STRING:
+ return 2;
- /* The only pointer notify data I have seen on
- the wire is the submitted time and this has
- the notify size set to 4. -tpot */
+ /* The only pointer notify data I have seen on
+ the wire is the submitted time and this has
+ the notify size set to 4. -tpot */
- case NOTIFY_POINTER:
- return 4;
+ case NOTIFY_POINTER:
+ return 4;
case NOTIFY_SECDESC:
return 5;
@@ -3476,23 +3473,23 @@
Return the type of notify_info_data.
********************************************************************/
-static int type_of_notify_info_data(uint16 type, uint16 field)
+static uint32 type_of_notify_info_data(uint16 type, uint16 field)
{
- int i=0;
+ uint32 i=0;
- for (i = 0; i < sizeof(notify_info_data_table); i++) {
+ for (i = 0; i < (sizeof(notify_info_data_table)/sizeof(struct s_notify_info_data_table)); i++) {
if (notify_info_data_table[i].type == type &&
notify_info_data_table[i].field == field)
return notify_info_data_table[i].size;
}
- return False;
+ return 0;
}
/****************************************************************************
****************************************************************************/
-static int search_notify(uint16 type, uint16 field, int *value)
+static BOOL search_notify(uint16 type, uint16 field, int *value)
{
int i;
@@ -3521,10 +3518,8 @@
info_data->enc_type = type_of_notify_info_data(type, field);
info_data->id = id;
-
}
-
/*******************************************************************
*
* fill a notify_info struct with info asked
More information about the samba-cvs
mailing list