malloc: Assure that THP mode read do write OOB end of stringt

This commit is contained in:
Adhemerval Zanella 2023-04-14 08:22:40 -03:00
parent 801deb07f6
commit 05fe3ecfff

View file

@ -61,6 +61,8 @@ __malloc_thp_mode (void)
char str[sizeof(mode_always)];
ssize_t s = __read_nocancel (fd, str, sizeof (str));
if (s >= sizeof str || s < 0)
return malloc_thp_mode_not_supported;
str[s] = '\0';
__close_nocancel (fd);