diff options
author | Harald Welte <laforge@gnumonks.org> | 2015-09-07 21:10:50 +0200 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2015-09-07 22:25:35 +0200 |
commit | 2204f9d43dbe0bbc6ec1a5e6b4b6a58f23974a2a (patch) | |
tree | 36040d7af089943ce00ffd2cf8be3cb08d9e55e6 /src/hnbgw_hnbap.c | |
parent | 5c11c9463779abb960f47c656dae533eab9f1abf (diff) |
hnbgw: zero-initialize the output struct before aper_decode()
asn1c has this strange behavior that the _output_ struct must be
zero-initialized.
Diffstat (limited to 'src/hnbgw_hnbap.c')
-rw-r--r-- | src/hnbgw_hnbap.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/hnbgw_hnbap.c b/src/hnbgw_hnbap.c index 5100bf5..495c71d 100644 --- a/src/hnbgw_hnbap.c +++ b/src/hnbgw_hnbap.c @@ -31,6 +31,7 @@ static int hnbgw_tx_hnb_register_acc(struct hnb_context *ctx) }; /* encode the Information Elements */ + memset(&accept_out, 0, sizeof(accept_out)); rc = hnbap_encode_hnbregisteraccepties(&accept_out, &accept); if (rc < 0) { return rc; @@ -54,8 +55,10 @@ static int hnbgw_tx_ue_register_acc(struct ue_context *ue) int rc; /* FIXME accept.uE_Identity; */ + memset(&accept, 0, sizeof(accept)); asn1_u32_to_bitstring(&accept.context_ID, &ue->context_id); + memset(&accept_out, 0, sizeof(accept_out)); rc = hnbap_encode_ueregisteraccepties(&accept_out, &accept); if (rc < 0) { return rc; @@ -179,6 +182,7 @@ int hnbgw_hnbap_rx(struct hnb_context *hnb, struct msgb *msg) /* decode and handle to _hnbgw_hnbap_rx() */ + memset(pdu, 0, sizeof(*pdu)); dec_ret = aper_decode(NULL, &asn_DEF_HNBAP_PDU, (void **) &pdu, msg->data, msgb_length(msg), 0, 0); if (dec_ret.code != RC_OK) { |