summaryrefslogtreecommitdiff
path: root/source3/rpc_parse/parse_spoolss.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2000-09-15 21:20:49 +0000
committerJeremy Allison <jra@samba.org>2000-09-15 21:20:49 +0000
commit244c29619965779d1076ea47d84d0d7edf3bef2d (patch)
treebf55edfac79bf0b90abee52b5a9e400a5cafa9f9 /source3/rpc_parse/parse_spoolss.c
parentccddd111c6b0c2d41c7b1e3875dca4e760205b79 (diff)
downloadsamba-244c29619965779d1076ea47d84d0d7edf3bef2d.tar.gz
samba-244c29619965779d1076ea47d84d0d7edf3bef2d.tar.bz2
samba-244c29619965779d1076ea47d84d0d7edf3bef2d.zip
Fixes from JF as I didn't understand the string array sizing code correctly.
Jeremy. (This used to be commit 63a7d0fc359ab7cb2ece74dff0ee25f6bb9fbe36)
Diffstat (limited to 'source3/rpc_parse/parse_spoolss.c')
-rw-r--r--source3/rpc_parse/parse_spoolss.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c
index cb24a97938..bd4ce43836 100644
--- a/source3/rpc_parse/parse_spoolss.c
+++ b/source3/rpc_parse/parse_spoolss.c
@@ -2871,14 +2871,26 @@ uint32 spoolss_size_printer_driver_info_3(DRIVER_INFO_3 *info)
return size;
}
+uint32 spoolss_size_string_array(uint16 *string)
+{
+ uint32 i = 0;
+
+ if (string) {
+ for (i=0; (string[i]!=0x0000) || (string[i+1]!=0x0000); i++);
+ }
+ i=i+2; /* to count all chars including the leading zero */
+ i=2*i; /* because we need the value in bytes */
+ i=i+4; /* the offset pointer size */
+
+ return i;
+}
+
/*******************************************************************
return the size required by a struct in the stream
********************************************************************/
uint32 spoolss_size_printer_driver_info_6(DRIVER_INFO_6 *info)
{
- int size=0;
- uint16 *string;
- int i=0;
+ uint32 size=0;
size+=size_of_uint32( &info->version );
size+=size_of_relative_string( &info->name );
@@ -2888,18 +2900,12 @@ uint32 spoolss_size_printer_driver_info_6(DRIVER_INFO_6 *info)
size+=size_of_relative_string( &info->configfile );
size+=size_of_relative_string( &info->helpfile );
- string=info->dependentfiles;
- if (string) {
- for (i=0; (string[i]!=0x0000) || (string[i+1]!=0x0000); i++);
- }
+ size+=spoolss_size_string_array(info->dependentfiles);
size+=size_of_relative_string( &info->monitorname );
size+=size_of_relative_string( &info->defaultdatatype );
- string=info->previousdrivernames;
- if (string) {
- for (i=0; (string[i]!=0x0000) || (string[i+1]!=0x0000); i++);
- }
+ size+=spoolss_size_string_array(info->previousdrivernames);
size+=size_of_nttime(&info->driver_date);
size+=size_of_uint32( &info->driver_version );
@@ -2908,12 +2914,6 @@ uint32 spoolss_size_printer_driver_info_6(DRIVER_INFO_6 *info)
size+=size_of_relative_string( &info->hardware_id );
size+=size_of_relative_string( &info->provider );
- i=i+2; /* to count all chars including the leading zero */
- i=2*i; /* because we need the value in bytes */
- i=i+4; /* the offset pointer size */
-
- size+=i;
-
return size;
}