diff options
author | Andreas Schneider <asn@samba.org> | 2010-04-28 11:26:08 +0200 |
---|---|---|
committer | Günther Deschner <gd@samba.org> | 2010-05-05 17:33:06 +0200 |
commit | 3f0562f4b4cfe770baf2e529a445404a7b8f1141 (patch) | |
tree | 8f15f5eb157f6a1a88fe69b1348c035411105e53 | |
parent | c95a79aae9f67dd476b7f6d1d12ad574b54c15ba (diff) | |
download | samba-3f0562f4b4cfe770baf2e529a445404a7b8f1141.tar.gz samba-3f0562f4b4cfe770baf2e529a445404a7b8f1141.tar.bz2 samba-3f0562f4b4cfe770baf2e529a445404a7b8f1141.zip |
s3-spoolss: Fixed memory error in winreg_get_driver.
The strings in the structure need to be initialized with an empty
string.
Signed-off-by: Günther Deschner <gd@samba.org>
-rw-r--r-- | source3/rpc_server/srv_spoolss_util.c | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/source3/rpc_server/srv_spoolss_util.c b/source3/rpc_server/srv_spoolss_util.c index 3ddf7eb715..995cb7becc 100644 --- a/source3/rpc_server/srv_spoolss_util.c +++ b/source3/rpc_server/srv_spoolss_util.c @@ -30,6 +30,8 @@ #define TOP_LEVEL_CONTROL_FORMS_KEY TOP_LEVEL_CONTROL_KEY "\\Forms" #define EMPTY_STRING "" +static const char *empty_string_array[1] = { NULL }; +#define EMPTY_STRING_ARRAY empty_string_array #define CHECK_ERROR(result) \ if (W_ERROR_IS_OK(result)) continue; \ @@ -3654,11 +3656,42 @@ WERROR winreg_get_driver(TALLOC_CTX *mem_ctx, } info8 = talloc_zero(tmp_ctx, struct spoolss_DriverInfo8); - if (!info8) { + if (info8 == NULL) { result = WERR_NOMEM; goto done; } + info8->driver_name = talloc_strdup(info8, driver_name); + if (info8->driver_name == NULL) { + result = WERR_NOMEM; + goto done; + } + + info8->architecture = talloc_strdup(info8, architecture); + if (info8->architecture == NULL) { + result = WERR_NOMEM; + goto done; + } + + info8->config_file = EMPTY_STRING; + info8->data_file = EMPTY_STRING; + info8->default_datatype = EMPTY_STRING; + info8->driver_path = EMPTY_STRING; + info8->hardware_id = EMPTY_STRING; + info8->help_file = EMPTY_STRING; + info8->inf_path = EMPTY_STRING; + info8->manufacturer_name = EMPTY_STRING; + info8->manufacturer_url = EMPTY_STRING; + info8->monitor_name = EMPTY_STRING; + info8->print_processor = EMPTY_STRING; + info8->provider = EMPTY_STRING; + info8->vendor_setup = EMPTY_STRING; + + info8->color_profiles = empty_string_array; + info8->core_driver_dependencies = EMPTY_STRING_ARRAY; + info8->dependent_files = EMPTY_STRING_ARRAY; + info8->previous_names = EMPTY_STRING_ARRAY; + result = WERR_OK; for (i = 0; i < num_values; i++) { |