fstring *tddfs;
tddfs = SMB_REALLOC_ARRAY(driver.dependentfiles, fstring, i+2);
- if (tddfs == NULL) {
+ if ( !tddfs ) {
DEBUG(0,("get_a_printer_driver_3: failed to enlarge buffer!\n"));
break;
}
- else driver.dependentfiles = tddfs;
+ else
+ driver.dependentfiles = tddfs;
len += tdb_unpack(dbuf.dptr+len, dbuf.dsize-len, "f",
&driver.dependentfiles[i]);
i++;
}
- if (driver.dependentfiles != NULL)
- fstrcpy(driver.dependentfiles[i], "");
+ if ( driver.dependentfiles )
+ fstrcpy( driver.dependentfiles[i], "" );
SAFE_FREE(dbuf.dptr);
{
int i = 0;
char *s;
+ pstring file;
connection_struct *conn;
DATA_BLOB null_pw;
NTSTATUS nt_status;
if ( *info_3->driverpath ) {
if ( (s = strchr( &info_3->driverpath[1], '\\' )) != NULL ) {
- driver_unix_convert(s, conn, NULL, &bad_path, &st);
+ pstrcpy( file, s );
+ driver_unix_convert(file, conn, NULL, &bad_path, &st);
DEBUG(10,("deleting driverfile [%s]\n", s));
- unlink_internals(conn, 0, s);
+ unlink_internals(conn, 0, file);
}
}
if ( *info_3->configfile ) {
if ( (s = strchr( &info_3->configfile[1], '\\' )) != NULL ) {
- driver_unix_convert(s, conn, NULL, &bad_path, &st);
+ pstrcpy( file, s );
+ driver_unix_convert(file, conn, NULL, &bad_path, &st);
DEBUG(10,("deleting configfile [%s]\n", s));
- unlink_internals(conn, 0, s);
+ unlink_internals(conn, 0, file);
}
}
if ( *info_3->datafile ) {
if ( (s = strchr( &info_3->datafile[1], '\\' )) != NULL ) {
- driver_unix_convert(s, conn, NULL, &bad_path, &st);
+ pstrcpy( file, s );
+ driver_unix_convert(file, conn, NULL, &bad_path, &st);
DEBUG(10,("deleting datafile [%s]\n", s));
- unlink_internals(conn, 0, s);
+ unlink_internals(conn, 0, file);
}
}
if ( *info_3->helpfile ) {
if ( (s = strchr( &info_3->helpfile[1], '\\' )) != NULL ) {
- driver_unix_convert(s, conn, NULL, &bad_path, &st);
+ pstrcpy( file, s );
+ driver_unix_convert(file, conn, NULL, &bad_path, &st);
DEBUG(10,("deleting helpfile [%s]\n", s));
- unlink_internals(conn, 0, s);
+ unlink_internals(conn, 0, file);
}
}
/* check if we are done removing files */
if ( info_3->dependentfiles ) {
- while ( *info_3->dependentfiles[i] ) {
- char *file;
+ while ( info_3->dependentfiles[i][0] ) {
+ char *p;
/* bypass the "\print$" portion of the path */
- if ( (file = strchr( info_3->dependentfiles[i]+1, '\\' )) != NULL ) {
+ if ( (p = strchr( info_3->dependentfiles[i]+1, '\\' )) != NULL ) {
+ pstrcpy( file, p );
driver_unix_convert(file, conn, NULL, &bad_path, &st);
DEBUG(10,("deleting dependent file [%s]\n", file));
unlink_internals(conn, 0, file );
int available_space; /* size of the device mode left to parse */
/* only important on unmarshalling */
int i = 0;
+ uint16 *unistr_buffer;
+ int j;
struct optional_fields {
fstring name;
depth++;
if (UNMARSHALLING(ps)) {
- devmode->devicename.buffer = PRS_ALLOC_MEM(ps, uint16, 32);
+ devmode->devicename.buffer = PRS_ALLOC_MEM(ps, uint16, MAXDEVICENAME);
if (devmode->devicename.buffer == NULL)
return False;
+ unistr_buffer = devmode->devicename.buffer;
}
-
- if (!prs_uint16uni(True,"devicename", ps, depth, devmode->devicename.buffer, MAXDEVICENAME))
+ else {
+ /* devicename is a static sized string but the buffer we set is not */
+ unistr_buffer = PRS_ALLOC_MEM(ps, uint16, MAXDEVICENAME);
+ memset( unistr_buffer, 0x0, MAXDEVICENAME );
+ for ( j=0; devmode->devicename.buffer[j]; j++ )
+ unistr_buffer[j] = devmode->devicename.buffer[j];
+ }
+
+ if (!prs_uint16uni(True,"devicename", ps, depth, unistr_buffer, MAXDEVICENAME))
return False;
if (!prs_uint16("specversion", ps, depth, &devmode->specversion))
return False;
if (UNMARSHALLING(ps)) {
- devmode->formname.buffer = PRS_ALLOC_MEM(ps, uint16, 32);
+ devmode->formname.buffer = PRS_ALLOC_MEM(ps, uint16, MAXDEVICENAME);
if (devmode->formname.buffer == NULL)
return False;
+ unistr_buffer = devmode->formname.buffer;
}
-
- if (!prs_uint16uni(True, "formname", ps, depth, devmode->formname.buffer, 32))
+ else {
+ /* devicename is a static sized string but the buffer we set is not */
+ unistr_buffer = PRS_ALLOC_MEM(ps, uint16, MAXDEVICENAME);
+ memset( unistr_buffer, 0x0, MAXDEVICENAME );
+ for ( j=0; devmode->formname.buffer[j]; j++ )
+ unistr_buffer[j] = devmode->formname.buffer[j];
+ }
+
+ if (!prs_uint16uni(True, "formname", ps, depth, unistr_buffer, MAXDEVICENAME))
return False;
if (!prs_uint16("logpixels", ps, depth, &devmode->logpixels))
return False;