From: findtheonlway <[email protected]> When recv packet from onos, the ovs may report an error or crash due to the buffer is uninitalized.
Signed-off-by: findtheonlway <[email protected]> Signed-off-by: sunwenjie <[email protected]> --- lib/util.c | 1 + ofproto/ofproto.c | 3 +++ 2 files changed, 4 insertions(+) diff --git a/lib/util.c b/lib/util.c index 7152b5539..e44f8f50a 100644 --- a/lib/util.c +++ b/lib/util.c @@ -122,6 +122,7 @@ xmalloc(size_t size) if (p == NULL) { out_of_memory(); } + memset(p, 0, size ? size : 1); return p; } diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c index 829ccd866..18a9b49e0 100644 --- a/ofproto/ofproto.c +++ b/ofproto/ofproto.c @@ -3559,6 +3559,9 @@ handle_packet_out(struct ofconn *ofconn, const struct ofp_header *oh) return error; } + memset(&po, 0, sizeof(struct ofputil_packet_out)); + memset(&opo, 0, sizeof(struct ofputil_packet_out)); + /* Decode message. */ ofpbuf_use_stub(&ofpacts, ofpacts_stub, sizeof ofpacts_stub); error = ofputil_decode_packet_out(&po, oh, ofproto_get_tun_tab(p), -- 2.14.1 _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
