summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorAndreas Schneider <asn@samba.org>2012-12-14 18:07:10 +0100
committerGünther Deschner <gd@samba.org>2012-12-21 13:56:00 +0100
commit15c0594feeed89b66d869bbfaf75f9af38269c33 (patch)
treecec5ae33dad63ef5b5dccfa23697dcea00872ebe /source3
parent5b1d95046c8ea624419d94dd7d9e2785ba86f556 (diff)
downloadsamba-15c0594feeed89b66d869bbfaf75f9af38269c33.tar.gz
samba-15c0594feeed89b66d869bbfaf75f9af38269c33.tar.bz2
samba-15c0594feeed89b66d869bbfaf75f9af38269c33.zip
s3-net: Check return values of push_reg_sz().
Found by Coverity. Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Günther Deschner <gd@samba.org>
Diffstat (limited to 'source3')
-rw-r--r--source3/utils/net_rpc_printer.c26
1 files changed, 22 insertions, 4 deletions
diff --git a/source3/utils/net_rpc_printer.c b/source3/utils/net_rpc_printer.c
index 0ab08efcc0..4fbe14f294 100644
--- a/source3/utils/net_rpc_printer.c
+++ b/source3/utils/net_rpc_printer.c
@@ -2512,6 +2512,8 @@ NTSTATUS rpc_printer_migrate_settings_internals(struct net_context *c,
struct registry_value value;
const char *value_name = info[j].value_name;
+ bool ok;
+
value.type = REG_SZ;
/* although samba replies with sane data in most cases we
@@ -2519,7 +2521,11 @@ NTSTATUS rpc_printer_migrate_settings_internals(struct net_context *c,
if (strequal(value_name, SPOOL_REG_PORTNAME)) {
/* although windows uses a multi-sz, we use a sz */
- push_reg_sz(mem_ctx, &value.data, SAMBA_PRINTER_PORT_NAME);
+ ok = push_reg_sz(mem_ctx, &value.data, SAMBA_PRINTER_PORT_NAME);
+ if (!ok) {
+ nt_status = NT_STATUS_NO_MEMORY;
+ goto done;
+ }
}
else if (strequal(value_name, SPOOL_REG_UNCNAME)) {
char *unc_name;
@@ -2527,7 +2533,11 @@ NTSTATUS rpc_printer_migrate_settings_internals(struct net_context *c,
nt_status = NT_STATUS_NO_MEMORY;
goto done;
}
- push_reg_sz(mem_ctx, &value.data, unc_name);
+ ok = push_reg_sz(mem_ctx, &value.data, unc_name);
+ if (!ok) {
+ nt_status = NT_STATUS_NO_MEMORY;
+ goto done;
+ }
free(unc_name);
}
else if (strequal(value_name, SPOOL_REG_URL)) {
@@ -2543,10 +2553,18 @@ NTSTATUS rpc_printer_migrate_settings_internals(struct net_context *c,
#endif
}
else if (strequal(value_name, SPOOL_REG_SERVERNAME)) {
- push_reg_sz(mem_ctx, &value.data, longname);
+ ok = push_reg_sz(mem_ctx, &value.data, longname);
+ if (!ok) {
+ nt_status = NT_STATUS_NO_MEMORY;
+ goto done;
+ }
}
else if (strequal(value_name, SPOOL_REG_SHORTSERVERNAME)) {
- push_reg_sz(mem_ctx, &value.data, lp_netbios_name());
+ ok = push_reg_sz(mem_ctx, &value.data, lp_netbios_name());
+ if (!ok) {
+ nt_status = NT_STATUS_NO_MEMORY;
+ goto done;
+ }
}
else {
value.type = info[j].type;