From 05be96a0332402f1213de4c1dba7e57d5398df59 Mon Sep 17 00:00:00 2001 From: yinchuang Date: Sat, 3 Feb 2024 19:52:13 +0800 Subject: [PATCH] [Asan] Fix bug of sendmsg hook Issue:I90UZR Signed-off-by: yinchuang --- .../lib/sanitizer_common/sanitizer_common_interceptors.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc b/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc index 006d5a9f5d38..cd60952a2605 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc @@ -3250,7 +3250,7 @@ static void read_msghdr_control(void *ctx, void *control, uptr controllen) { __sanitizer_cmsghdr *cmsg = (__sanitizer_cmsghdr *)p; COMMON_INTERCEPTOR_READ_RANGE(ctx, &cmsg->cmsg_len, sizeof(cmsg->cmsg_len)); - if (p + RoundUpTo(cmsg->cmsg_len, sizeof(uptr)) > control_end) break; + if (control_end - p < RoundUpTo(cmsg->cmsg_len, sizeof(uptr))) break; // OHOS_LOCAL COMMON_INTERCEPTOR_READ_RANGE(ctx, &cmsg->cmsg_level, sizeof(cmsg->cmsg_level)); -- Gitee