Avoid writing unitialised bytes to the wire (and consequent valgrind warnings)
authorAndrew Bartlett <abartlet@samba.org>
Sat, 31 Aug 2002 06:38:27 +0000 (06:38 +0000)
committerAndrew Bartlett <abartlet@samba.org>
Sat, 31 Aug 2002 06:38:27 +0000 (06:38 +0000)
by zeroing them out if they don't have meaning.

Andrew Bartlett
(This used to be commit 52db44b5c01e16923393b0ec9a8d0f530be7bb2d)

source3/rpc_parse/parse_reg.c

index f3018cfb373fed2b01515b4023469b9d7989ff62..2698e8244076a50ebf748293f4ea269ec2af39c2 100644 (file)
@@ -1701,7 +1701,11 @@ BOOL reg_io_q_open_entry(char *desc,  REG_Q_OPEN_ENTRY *r_q, prs_struct *ps, int
 void init_reg_r_open_entry(REG_R_OPEN_ENTRY *r_r,
                           POLICY_HND *pol, NTSTATUS status)
 {
-       memcpy(&r_r->pol, pol, sizeof(r_r->pol));
+       if (NT_STATUS_IS_OK(status)) {
+               memcpy(&r_r->pol, pol, sizeof(r_r->pol));
+       } else {
+               ZERO_STRUCT(r_r->pol);
+       }
        r_r->status = status;
 }