ssl: convert memcpy to strlcpy to avoid flto issue

When using ASAN, flto=auto and compiling on a platform that supports
AVX-512, this memcpy is optimized as its exactly 64 bytes. However, when
using ASAN, there is a fake stack that may not be 64 bytes aligned, and
this AVX write lands on an unaligned byte, causing a crash.

Use strlcpy avoids this optimization as it needs to find the NUL byte.
pull/15265/head
Jason Ish 3 months ago committed by Victor Julien
parent 9677851637
commit d1481af94e

@ -268,7 +268,7 @@ static DetectSslStateData *DetectSslStateParse(const char *arg)
goto error;
}
memcpy(str1, str2, sizeof(str1));
strlcpy(str1, str2, sizeof(str1));
pcre2_match_data_free(match2);
}

Loading…
Cancel
Save