From e7a3e415ba0ca8daf22fecb235577e87d637864c Mon Sep 17 00:00:00 2001 From: shikokuchuo <53399081+shikokuchuo@users.noreply.github.com> Date: Sun, 5 Feb 2023 22:54:04 +0000 Subject: Update idhash.c (#1638) Fix for UBSAN error. As `id_reg_map` is initialised as NULL and passing NULL to `memcpy()` is undefined. Should make no difference to compiled code. Purely to appease the automated checks I have to deal with on my side. Thanks! --- src/core/idhash.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/core') diff --git a/src/core/idhash.c b/src/core/idhash.c index 9eb959d6..c56c8191 100644 --- a/src/core/idhash.c +++ b/src/core/idhash.c @@ -129,7 +129,8 @@ id_map_register(nni_id_map *m) return (NNG_ENOMEM); } id_reg_len = len; - memcpy(mr, id_reg_map, id_reg_num * sizeof(nni_id_map *)); + if (id_reg_map != NULL) + memcpy(mr, id_reg_map, id_reg_num * sizeof(nni_id_map *)); id_reg_map = mr; } id_reg_map[id_reg_num++] = m; -- cgit v1.2.3-70-g09d2