mirror of
https://github.com/fluencelabs/musl
synced 2025-06-24 20:21:59 +00:00
posix_memalign should fail if size is not a multiple of sizeof(void *)
This commit is contained in:
@ -11,7 +11,7 @@ int posix_memalign(void **res, size_t align, size_t len)
|
|||||||
unsigned char *mem, *new, *end;
|
unsigned char *mem, *new, *end;
|
||||||
size_t header, footer;
|
size_t header, footer;
|
||||||
|
|
||||||
if ((align & -align) != align) return EINVAL;
|
if ((align & -align & -sizeof(void *)) != align) return EINVAL;
|
||||||
if (len > SIZE_MAX - align) return ENOMEM;
|
if (len > SIZE_MAX - align) return ENOMEM;
|
||||||
|
|
||||||
if (align <= 4*sizeof(size_t)) {
|
if (align <= 4*sizeof(size_t)) {
|
||||||
|
Reference in New Issue
Block a user