diff options
Diffstat (limited to 'source3/rpc_parse')
-rw-r--r-- | source3/rpc_parse/parse_spoolss.c | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 155fa7b3c9..997d29be89 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -558,15 +558,26 @@ BOOL spoolss_io_devmode(char *desc, prs_struct *ps, int depth, DEVICEMODE *devmo fstring name; uint32* field; } opt_fields[DM_NUM_OPTIONAL_FIELDS] = { - { "icmmethod", &devmode->icmmethod }, - { "icmintent", &devmode->icmintent }, - { "mediatype", &devmode->mediatype }, - { "dithertype", &devmode->dithertype }, - { "reserved1", &devmode->reserved1 }, - { "reserved2", &devmode->reserved2 }, - { "panningwidth", &devmode->panningwidth }, - { "panningheight", &devmode->panningheight } + { "icmmethod", NULL }, + { "icmintent", NULL }, + { "mediatype", NULL }, + { "dithertype", NULL }, + { "reserved1", NULL }, + { "reserved2", NULL }, + { "panningwidth", NULL }, + { "panningheight", NULL } }; + + /* assign at run time to keep non-gcc vompilers happy */ + + opt_fields[0].field = &devmode->icmmethod; + opt_fields[1].field = &devmode->icmintent; + opt_fields[2].field = &devmode->mediatype; + opt_fields[3].field = &devmode->dithertype; + opt_fields[4].field = &devmode->reserved1; + opt_fields[5].field = &devmode->reserved2; + opt_fields[6].field = &devmode->panningwidth; + opt_fields[7].field = &devmode->panningheight; prs_debug(ps, depth, desc, "spoolss_io_devmode"); @@ -667,7 +678,7 @@ BOOL spoolss_io_devmode(char *desc, prs_struct *ps, int depth, DEVICEMODE *devmo /* Sanity check - we only have uint32's left tp parse */ - if ( available_space && ((available_space % 4) != 0) ) { + if ( available_space && ((available_space % sizeof(uint32)) != 0) ) { DEBUG(0,("spoolss_io_devmode: available_space [%d] no in multiple of 4 bytes (size = %d)!\n", available_space, devmode->size)); DEBUG(0,("spoolss_io_devmode: please report to samba-technical@samba.org!\n")); @@ -679,7 +690,7 @@ BOOL spoolss_io_devmode(char *desc, prs_struct *ps, int depth, DEVICEMODE *devmo * zero'd by the caller. */ - while (available_space && (i<DM_NUM_OPTIONAL_FIELDS)) + while ((available_space > 0) && (i < DM_NUM_OPTIONAL_FIELDS)) { if (!prs_uint32(opt_fields[i].name, ps, depth, opt_fields[i].field)) return False; @@ -699,7 +710,6 @@ BOOL spoolss_io_devmode(char *desc, prs_struct *ps, int depth, DEVICEMODE *devmo } -parse_driverextra: if (devmode->driverextra!=0) { if (UNMARSHALLING(ps)) { devmode->private=(uint8 *)prs_alloc_mem(ps, devmode->driverextra*sizeof(uint8)); |