summaryrefslogtreecommitdiff
path: root/source3/printing
diff options
context:
space:
mode:
Diffstat (limited to 'source3/printing')
-rw-r--r--source3/printing/nt_printing.c8
-rw-r--r--source3/printing/printing.c10
2 files changed, 14 insertions, 4 deletions
diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c
index c55f9f1f91..afa4bc2fd5 100644
--- a/source3/printing/nt_printing.c
+++ b/source3/printing/nt_printing.c
@@ -4017,6 +4017,7 @@ static WERROR get_a_printer_2(NT_PRINTER_INFO_LEVEL_2 *info, const char *servern
TDB_DATA kbuf, dbuf;
fstring printername;
char adevice[MAXDEVICENAME];
+ char *comment = NULL;
kbuf = make_printer_tdbkey(talloc_tos(), sharename);
@@ -4042,13 +4043,18 @@ static WERROR get_a_printer_2(NT_PRINTER_INFO_LEVEL_2 *info, const char *servern
info->sharename,
info->portname,
info->drivername,
- info->comment,
+ &comment,
info->location,
info->sepfile,
info->printprocessor,
info->datatype,
info->parameters);
+ if (comment) {
+ strlcpy(info->comment, comment, sizeof(info->comment));
+ SAFE_FREE(comment);
+ }
+
/* Samba has to have shared raw drivers. */
info->attributes |= PRINTER_ATTRIBUTE_SAMBA;
info->attributes &= ~PRINTER_ATTRIBUTE_NOT_SAMBA;
diff --git a/source3/printing/printing.c b/source3/printing/printing.c
index d331e897f9..1613828b79 100644
--- a/source3/printing/printing.c
+++ b/source3/printing/printing.c
@@ -1352,17 +1352,19 @@ static void print_queue_receive(struct messaging_context *msg,
DATA_BLOB *data)
{
fstring sharename;
- pstring lpqcommand, lprmcommand;
+ char *lpqcommand = NULL, *lprmcommand = NULL;
int printing_type;
size_t len;
len = tdb_unpack( (uint8 *)data->data, data->length, "fdPP",
sharename,
&printing_type,
- lpqcommand,
- lprmcommand );
+ &lpqcommand,
+ &lprmcommand );
if ( len == -1 ) {
+ SAFE_FREE(lpqcommand);
+ SAFE_FREE(lprmcommand);
DEBUG(0,("print_queue_receive: Got invalid print queue update message\n"));
return;
}
@@ -1371,6 +1373,8 @@ static void print_queue_receive(struct messaging_context *msg,
get_printer_fns_from_type((enum printing_types)printing_type),
lpqcommand, lprmcommand );
+ SAFE_FREE(lpqcommand);
+ SAFE_FREE(lprmcommand);
return;
}