diff options
author | Volker Lendecke <vl@samba.org> | 2008-06-26 15:32:27 +0200 |
---|---|---|
committer | Volker Lendecke <vl@samba.org> | 2008-06-26 15:35:56 +0200 |
commit | 5a63e1dcb62144dcdf15ab80af6357d5954d27c1 (patch) | |
tree | 589798ae80a889af3b139d0178656f98ed8cc010 /source3/rpcclient | |
parent | 3c516937e80bcac5dd453dd9e6f83ccb67c5a22b (diff) | |
download | samba-5a63e1dcb62144dcdf15ab80af6357d5954d27c1.tar.gz samba-5a63e1dcb62144dcdf15ab80af6357d5954d27c1.tar.bz2 samba-5a63e1dcb62144dcdf15ab80af6357d5954d27c1.zip |
Fix a segfault in rpcclient adddriver
(cherry picked from commit d4b5a9d67389578f531527b339f6feead62f082d)
(This used to be commit 8573032877317fe1f5c69e9ced5b19a33d8aefb0)
Diffstat (limited to 'source3/rpcclient')
-rw-r--r-- | source3/rpcclient/cmd_spoolss.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/source3/rpcclient/cmd_spoolss.c b/source3/rpcclient/cmd_spoolss.c index fc4e0eb042..0876d82878 100644 --- a/source3/rpcclient/cmd_spoolss.c +++ b/source3/rpcclient/cmd_spoolss.c @@ -1219,13 +1219,13 @@ void set_drv_info_3_env (DRIVER_INFO_3 *info, const char *arch) Needed to handle the empty parameter string denoted by "NULL" *************************************************************************/ -static char* get_driver_3_param (char* str, const char* delim, UNISTR* dest) +static char* get_driver_3_param (char* str, const char* delim, UNISTR* dest, + char **saveptr) { char *ptr; - char *saveptr; /* get the next token */ - ptr = strtok_r(str, delim, &saveptr); + ptr = strtok_r(str, delim, saveptr); /* a string of 'NULL' is used to represent an empty parameter because two consecutive delimiters @@ -1255,17 +1255,18 @@ static bool init_drv_info_3_members ( TALLOC_CTX *mem_ctx, DRIVER_INFO_3 *info, char *saveptr = NULL; /* fill in the UNISTR fields */ - str = get_driver_3_param (args, ":", &info->name); - str = get_driver_3_param (NULL, ":", &info->driverpath); - str = get_driver_3_param (NULL, ":", &info->datafile); - str = get_driver_3_param (NULL, ":", &info->configfile); - str = get_driver_3_param (NULL, ":", &info->helpfile); - str = get_driver_3_param (NULL, ":", &info->monitorname); - str = get_driver_3_param (NULL, ":", &info->defaultdatatype); + str = get_driver_3_param (args, ":", &info->name, &saveptr); + str = get_driver_3_param (NULL, ":", &info->driverpath, &saveptr); + str = get_driver_3_param (NULL, ":", &info->datafile, &saveptr); + str = get_driver_3_param (NULL, ":", &info->configfile, &saveptr); + str = get_driver_3_param (NULL, ":", &info->helpfile, &saveptr); + str = get_driver_3_param (NULL, ":", &info->monitorname, &saveptr); + str = get_driver_3_param (NULL, ":", &info->defaultdatatype, &saveptr); /* <Comma Separated List of Dependent Files> */ - str2 = get_driver_3_param (NULL, ":", NULL); /* save the beginning of the string */ - str = str2; + /* save the beginning of the string */ + str2 = get_driver_3_param (NULL, ":", NULL, &saveptr); + str = str2; /* begin to strip out each filename */ str = strtok_r(str, ",", &saveptr); |