diff options
-rw-r--r-- | source3/rpc_parse/parse_spoolss.c | 16 | ||||
-rwxr-xr-x | source3/rpc_server/srv_spoolss.c | 12 |
2 files changed, 20 insertions, 8 deletions
diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 7b15ba2a42..c66d176c78 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -828,15 +828,25 @@ static void smb_io_relarraystr(char *desc, prs_struct *ps, int depth, UNISTR *** uint32 relative_offset; struct_offset=ps->offset; - while ( (*buffer)[i]!=0x0000 ) { + i++; + } + + i--; + + /* that's for the ending NULL */ + *end_offset-=2; + + do + { *end_offset-= 2*(str_len_uni((*buffer)[i])+1); ps->offset=*end_offset; spoolss_smb_io_unistr(desc, (*buffer)[i], ps, depth); - i++; + i--; } + while (i>=0); ps->offset=struct_offset; relative_offset=*end_offset-*start_offset; @@ -1328,7 +1338,7 @@ static uint32 spoolss_size_printer_driver_info_3(DRIVER_INFO_3 *info) size+=2*(1+ str_len_uni( string[i] ) ); i++; } - size+=4; + size+=6; DEBUGADD(9,("size: [%d]\n", size)); return (size); diff --git a/source3/rpc_server/srv_spoolss.c b/source3/rpc_server/srv_spoolss.c index 067fdd3ff7..eee3fcbe68 100755 --- a/source3/rpc_server/srv_spoolss.c +++ b/source3/rpc_server/srv_spoolss.c @@ -2012,11 +2012,11 @@ static void fill_printer_driver_info_2(DRIVER_INFO_2 *info, driver.info_3->driverpath); make_unistr( &(info->driverpath), temp_driverpath ); - snprintf(temp_datafile, sizeof(temp_driverpath)-1, "%s%s", where, + snprintf(temp_datafile, sizeof(temp_datafile)-1, "%s%s", where, driver.info_3->datafile); make_unistr( &(info->datafile), temp_datafile ); - snprintf(temp_configfile, sizeof(temp_driverpath)-1, "%s%s", where, + snprintf(temp_configfile, sizeof(temp_configfile)-1, "%s%s", where, driver.info_3->configfile); make_unistr( &(info->configfile), temp_configfile ); } @@ -2043,10 +2043,11 @@ static void construct_printer_driver_info_2(DRIVER_INFO_2 *info, int snum, /******************************************************************** * copy a strings array and convert to UNICODE ********************************************************************/ -static void make_unistr_array(UNISTR ***uni_array, char **char_array) +static void make_unistr_array(UNISTR ***uni_array, char **char_array, char *where) { int i=0; char *v; + pstring line; DEBUG(6,("make_unistr_array\n")); @@ -2061,7 +2062,8 @@ static void make_unistr_array(UNISTR ***uni_array, char **char_array) (*uni_array)[i]=(UNISTR *)malloc( sizeof(UNISTR) ); DEBUGADD(7,("alloc:[%p],", (*uni_array)[i])); - make_unistr( (*uni_array)[i], v ); + snprintf(line, sizeof(line)-1, "%s%s", where, v); + make_unistr( (*uni_array)[i], line ); DEBUGADD(7,("copy\n")); i++; @@ -2114,7 +2116,7 @@ static void fill_printer_driver_info_3(DRIVER_INFO_3 *info, make_unistr( &(info->defaultdatatype), driver.info_3->defaultdatatype ); info->dependentfiles=NULL; - make_unistr_array(&(info->dependentfiles), driver.info_3->dependentfiles); + make_unistr_array(&(info->dependentfiles), driver.info_3->dependentfiles, where); } /******************************************************************** |