zeam-vm/excv

Should not use strnlen

Closed this issue · 0 comments

In the c_src/excv/error.c, strnlen is used, but the following warning occurs on Linux:

c_src/excv/error.c: In functionmake_error’:
c_src/excv/error.c:9:44: warning: implicit declaration of functionstrnlen’; did you meanstrlen’? [-Wimplicit-function-declaration]
     if(__builtin_expect(!enif_alloc_binary(strnlen(message, 256), &reason), false)) {
                                            ^~~~~~~
                                            strlen

And the following loading error occurs on Linux:

05:12:44.003 [error] Failed to load NIF: {:load_failed, 'Failed to load NIF library: \'/media/zacky/xavier/zacky/github/gamma_excv/_build/dev/lib/excv/priv/libexcv.so: undefined symbol: _ZTIN2cv9ExceptionE\''}

I found strnlen should not use in the article: https://stackoverflow.com/questions/66346502/which-is-most-standard-strnlen-or-strnlen-s