On Wed, Aug 17, 2022 at 6:01 PM Ales Musil <[email protected]> wrote:
>
> On Tue, Aug 16, 2022 at 4:47 PM Dumitru Ceara <[email protected]> wrote:
>
> > Reported by UndefinedBehaviorSanitizer when running in a sandbox:
> > controller/ovn-controller.c:374:21: runtime error: null pointer passed
> > as argument 2, which is declared to never be null
> > /usr/include/string.h:44:28: note: nonnull attribute specified here
> > SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior
> > controller/ovn-controller.c:374:21
> >
> > Signed-off-by: Dumitru Ceara <[email protected]>
> > ---
> > controller/ovn-controller.c | 4 +++-
> > 1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/controller/ovn-controller.c b/controller/ovn-controller.c
> > index 8268726e6..96270c824 100644
> > --- a/controller/ovn-controller.c
> > +++ b/controller/ovn-controller.c
> > @@ -371,7 +371,9 @@ create_br_int(struct ovsdb_idl_txn *ovs_idl_txn,
> > struct ovsrec_bridge **bridges;
> > size_t bytes = sizeof *bridges * cfg->n_bridges;
> > bridges = xmalloc(bytes + sizeof *bridges);
> > - memcpy(bridges, cfg->bridges, bytes);
> > + if (cfg->n_bridges) {
> > + memcpy(bridges, cfg->bridges, bytes);
> > + }
> > bridges[cfg->n_bridges] = bridge;
> > ovsrec_open_vswitch_verify_bridges(cfg);
> > ovsrec_open_vswitch_set_bridges(cfg, bridges, cfg->n_bridges + 1);
> > --
> > 2.31.1
> >
> > _______________________________________________
> > dev mailing list
> > [email protected]
> > https://mail.openvswitch.org/mailman/listinfo/ovs-dev
> >
> >
> Makes sense, thanks!
>
> Acked-by: Ales Musil <[email protected]>
Thanks. Applied to the main branch.
Numan
>
> --
>
> Ales Musil
>
> Senior Software Engineer - OVN Core
>
> Red Hat EMEA <https://www.redhat.com>
>
> [email protected] IM: amusil
> <https://red.ht/sig>
> _______________________________________________
> dev mailing list
> [email protected]
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
>
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev