Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tree data BUGFIX don't send null argument into strncmp
The recent patch was sending a NULL pointer to ly_strncmp which passed the NULL to strncmp. However, strncmp arguments are attributed as nonnull which make undefined behaviour sanitizer unhappy. This ubsan report appeared when running sysrepo tests: /build/libyang/src/ly_common.c:114:30: runtime error: null pointer passed as argument 2, which is declared to never be null /usr/include/string.h:160:33: note: nonnull attribute specified here #0 0x79c7f4278907 in ly_strncmp /build/libyang/src/ly_common.c:114:14 #1 0x79c7f43faf24 in lyd_new_path_ /build/libyang/src/tree_data_new.c:1736:55 #2 0x79c7f43fdf61 in lyd_new_path2 /build/libyang/src/tree_data_new.c:1861:12 #3 0x79c7f5249b24 in sr_lyd_new_path /build/dependencies/sysrepo/src/ly_wrap.c:644:9 #4 0x79c7f52ec883 in sr_edit_add /build/dependencies/sysrepo/src/edit_diff.c:3765:20 #5 0x79c7f5195824 in sr_delete_item /build/dependencies/sysrepo/src/sysrepo.c:3453:16 #6 0x5c9e51a98f6e in clear_test /build/sysrepo/tests/test_edit.c:120:5 #7 0x79c7f56da98c (/usr/lib/libcmocka.so.0+0x698c) (BuildId: 4d284c2a057f6dbeaa60a5e68cb5891237d21ae1) #8 0x79c7f56db51c in _cmocka_run_group_tests (/usr/lib/libcmocka.so.0+0x751c) (BuildId: 4d284c2a057f6dbeaa60a5e68cb5891237d21ae1) #9 0x5c9e51a91f41 in main /build/sysrepo/tests/test_edit.c:1571:12 #10 0x79c7f3b4ec87 (/usr/lib/libc.so.6+0x25c87) (BuildId: 32a656aa5562eece8c59a585f5eacd6cf5e2307b) #11 0x79c7f3b4ed4b in __libc_start_main (/usr/lib/libc.so.6+0x25d4b) (BuildId: 32a656aa5562eece8c59a585f5eacd6cf5e2307b) #12 0x5c9e5195a2b4 in _start (/build/sysrepo/build-clang-asan/tests/test_edit+0x3a2b4) (BuildId: dc378717130c22094495ee54dcfbdc3254b5f981) Fixes: ed74a24 tree data UPDATE recognize special JSON [null] value
- Loading branch information