From d92760fbb9f99e0e1e2743183ce95562f707dec3 Mon Sep 17 00:00:00 2001 From: elliott_c Date: Tue, 25 Mar 2008 17:59:42 +0000 Subject: ChangeLogTag: Tue Mar 25 18:02:52 UTC 2008 Chad Elliott --- ACE/ASNMP/asnmp/wpdu.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'ACE/ASNMP') diff --git a/ACE/ASNMP/asnmp/wpdu.cpp b/ACE/ASNMP/asnmp/wpdu.cpp index e99ab66821e..503ed66f283 100644 --- a/ACE/ASNMP/asnmp/wpdu.cpp +++ b/ACE/ASNMP/asnmp/wpdu.cpp @@ -98,12 +98,17 @@ wpdu::wpdu(const Pdu& pdu, const UdpTarget& target): ACE_NEW(iovec_.iov_base, char [iovec_.iov_len]); // create raw byte stream + // The intermediate integer is to avoid type-punned pointer + // dereferencing. + int out_length = iovec_.iov_len; status = cmu_snmp::build( raw_pdu, (unsigned char *)iovec_.iov_base, - (int *) &iovec_.iov_len, + &out_length, target.get_version(), comm_str.data(), comm_str.length()); + iovec_.iov_len = out_length; + if ( status != 0) { valid_flag_ = SNMP_ERROR_WRONG_ENCODING; cmu_snmp::free_pdu( raw_pdu); -- cgit v1.2.1