diff options
| author | shikokuchuo <53399081+shikokuchuo@users.noreply.github.com> | 2023-02-05 22:54:04 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-02-05 18:54:04 -0400 |
| commit | e7a3e415ba0ca8daf22fecb235577e87d637864c (patch) | |
| tree | 25b72890efcc9efca3be314c4e7838ce94486067 /src/core/idhash.c | |
| parent | 539e559e65cd8f227c45e4b046ac41c0edcf6c32 (diff) | |
| download | nng-e7a3e415ba0ca8daf22fecb235577e87d637864c.tar.gz nng-e7a3e415ba0ca8daf22fecb235577e87d637864c.tar.bz2 nng-e7a3e415ba0ca8daf22fecb235577e87d637864c.zip | |
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!
Diffstat (limited to 'src/core/idhash.c')
| -rw-r--r-- | src/core/idhash.c | 3 |
1 files changed, 2 insertions, 1 deletions
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; |
