return 0;
}
-SANITIZER_INTERFACE_ATTRIBUTE int __dfsw_bcmp(const void *s1, const void *s2,
- size_t n, dfsan_label s1_label,
- dfsan_label s2_label,
- dfsan_label n_label,
- dfsan_label *ret_label) {
- return __dfsw_memcmp(s1, s2, n, s1_label, s2_label, n_label, ret_label);
-}
-
DECLARE_WEAK_INTERCEPTOR_HOOK(dfsan_weak_hook_strcmp, uptr caller_pc,
const char *s1, const char *s2,
dfsan_label s1_label, dfsan_label s2_label)
#include <pwd.h>
#include <sched.h>
#include <signal.h>
-#include <stdint.h>
#include <stdio.h>
+#include <stdint.h>
#include <stdlib.h>
#include <string.h>
-#include <strings.h>
-#include <sys/resource.h>
#include <sys/select.h>
+#include <sys/resource.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/types.h>
#endif
}
-void test_bcmp() {
- char str1[] = "str1", str2[] = "str2";
- dfsan_set_label(i_label, &str1[3], 1);
- dfsan_set_label(j_label, &str2[3], 1);
-
- int rv = bcmp(str1, str2, sizeof(str1));
- assert(rv != 0);
-#ifdef STRICT_DATA_DEPENDENCIES
- ASSERT_ZERO_LABEL(rv);
-#else
- ASSERT_LABEL(rv, i_j_label);
-#endif
-
- rv = bcmp(str1, str2, sizeof(str1) - 2);
- assert(rv == 0);
- ASSERT_ZERO_LABEL(rv);
-}
-
void test_memcpy() {
char str1[] = "str1";
char str2[sizeof(str1)];
assert(i_j_label != j_label);
assert(i_j_label != k_label);
- test_bcmp();
test_calloc();
test_clock_gettime();
test_ctime_r();