summaryrefslogtreecommitdiff
path: root/source3/registry
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2003-01-17 04:58:45 +0000
committerAndrew Tridgell <tridge@samba.org>2003-01-17 04:58:45 +0000
commitec879eacc263043409b584797d1e8c39258ba125 (patch)
tree7a7775040b27f7fea0f7bd1c8f0ede91c9ce770d /source3/registry
parentba51d1d888f98e196627486490e8569faeb641c2 (diff)
downloadsamba-ec879eacc263043409b584797d1e8c39258ba125.tar.gz
samba-ec879eacc263043409b584797d1e8c39258ba125.tar.bz2
samba-ec879eacc263043409b584797d1e8c39258ba125.zip
This removes the 3rd argument from init_unistr2(). There were 240
calls to init_unistr2() in the code and every one of them got the 3rd argument incorrect, so I thought it best just to remove the argument. The incorrect usage was caused by callers using strlen() to determine the length of the string. The 3rd argument to init_unistr2() was supposed to be the character length, not the byte length of the string, so for non-english this could come out wrong. I also removed the bogus 'always allocate at least 256 bytes' hack. There may be some code that relies on this, but if there is then the code is broken and needs fixing. (This used to be commit b9eff31b1433c81fbff733e194914a40f25e3bda)
Diffstat (limited to 'source3/registry')
-rw-r--r--source3/registry/reg_printing.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/source3/registry/reg_printing.c b/source3/registry/reg_printing.c
index 4b8eaa658e..6840dd9623 100644
--- a/source3/registry/reg_printing.c
+++ b/source3/registry/reg_printing.c
@@ -288,22 +288,22 @@ static int print_subpath_values_environments( char *key, REGVAL_CTR *val )
info3 = driver_ctr.info_3;
filename = dos_basename( info3->driverpath );
- init_unistr2( &data, filename, strlen(filename)+1 );
+ init_unistr2( &data, filename);
regval_ctr_addvalue( val, "Driver", REG_SZ, (char*)data.buffer, data.uni_str_len*sizeof(uint16) );
filename = dos_basename( info3->configfile );
- init_unistr2( &data, filename, strlen(filename)+1 );
+ init_unistr2( &data, filename);
regval_ctr_addvalue( val, "Configuration File", REG_SZ, (char*)data.buffer, data.uni_str_len*sizeof(uint16) );
filename = dos_basename( info3->datafile );
- init_unistr2( &data, filename, strlen(filename)+1 );
+ init_unistr2( &data, filename);
regval_ctr_addvalue( val, "Data File", REG_SZ, (char*)data.buffer, data.uni_str_len*sizeof(uint16) );
filename = dos_basename( info3->helpfile );
- init_unistr2( &data, filename, strlen(filename)+1 );
+ init_unistr2( &data, filename);
regval_ctr_addvalue( val, "Help File", REG_SZ, (char*)data.buffer, data.uni_str_len*sizeof(uint16) );
- init_unistr2( &data, info3->defaultdatatype, strlen(info3->defaultdatatype)+1 );
+ init_unistr2( &data, info3->defaultdatatype);
regval_ctr_addvalue( val, "Data Type", REG_SZ, (char*)data.buffer, data.uni_str_len*sizeof(uint16) );
regval_ctr_addvalue( val, "Version", REG_DWORD, (char*)&info3->cversion, sizeof(info3->cversion) );
@@ -327,7 +327,7 @@ static int print_subpath_values_environments( char *key, REGVAL_CTR *val )
break;
buffer = buffer2;
- init_unistr2( &data, filename, length+1 );
+ init_unistr2( &data, filename);
memcpy( buffer+buffer_size, (char*)data.buffer, data.uni_str_len*sizeof(uint16) );
buffer_size += (length + 1)*sizeof(uint16);
@@ -573,25 +573,25 @@ static int print_subpath_values_printers( char *key, REGVAL_CTR *val )
regval_ctr_addvalue( val, "cjobs", REG_DWORD, (char*)&info2->cjobs, sizeof(info2->cjobs) );
regval_ctr_addvalue( val, "AveragePPM", REG_DWORD, (char*)&info2->averageppm, sizeof(info2->averageppm) );
- init_unistr2( &data, info2->printername, strlen(info2->printername)+1 );
+ init_unistr2( &data, info2->printername);
regval_ctr_addvalue( val, "Name", REG_SZ, (char*)data.buffer, data.uni_str_len*sizeof(uint16) );
- init_unistr2( &data, info2->location, strlen(info2->location)+1 );
+ init_unistr2( &data, info2->location);
regval_ctr_addvalue( val, "Location", REG_SZ, (char*)data.buffer, data.uni_str_len*sizeof(uint16) );
- init_unistr2( &data, info2->comment, strlen(info2->comment)+1 );
+ init_unistr2( &data, info2->comment);
regval_ctr_addvalue( val, "Comment", REG_SZ, (char*)data.buffer, data.uni_str_len*sizeof(uint16) );
- init_unistr2( &data, info2->parameters, strlen(info2->parameters)+1 );
+ init_unistr2( &data, info2->parameters);
regval_ctr_addvalue( val, "Parameters", REG_SZ, (char*)data.buffer, data.uni_str_len*sizeof(uint16) );
- init_unistr2( &data, info2->portname, strlen(info2->portname)+1 );
+ init_unistr2( &data, info2->portname);
regval_ctr_addvalue( val, "Port", REG_SZ, (char*)data.buffer, data.uni_str_len*sizeof(uint16) );
- init_unistr2( &data, info2->servername, strlen(info2->servername)+1 );
+ init_unistr2( &data, info2->servername);
regval_ctr_addvalue( val, "Server", REG_SZ, (char*)data.buffer, data.uni_str_len*sizeof(uint16) );
- init_unistr2( &data, info2->sharename, strlen(info2->sharename)+1 );
+ init_unistr2( &data, info2->sharename);
regval_ctr_addvalue( val, "Share", REG_SZ, (char*)data.buffer, data.uni_str_len*sizeof(uint16) );
- init_unistr2( &data, info2->drivername, strlen(info2->drivername)+1 );
+ init_unistr2( &data, info2->drivername);
regval_ctr_addvalue( val, "Driver", REG_SZ, (char*)data.buffer, data.uni_str_len*sizeof(uint16) );
- init_unistr2( &data, info2->sepfile, strlen(info2->sepfile)+1 );
+ init_unistr2( &data, info2->sepfile);
regval_ctr_addvalue( val, "Separator File", REG_SZ, (char*)data.buffer, data.uni_str_len*sizeof(uint16) );
- init_unistr2( &data, "winprint", strlen("winprint")+1 );
+ init_unistr2( &data, "winprint");
regval_ctr_addvalue( val, "Print Processor", REG_SZ, (char*)data.buffer, data.uni_str_len*sizeof(uint16) );