From: Rich Felker Date: Wed, 29 Jun 2011 23:26:30 +0000 (-0400) Subject: posix_memalign should fail if size is not a multiple of sizeof(void *) X-Git-Url: http://nsz.repo.hu/git/?p=musl;a=commitdiff_plain;h=f9ed11f3e1337d6bac6298db1d66d4f27bb59f6b;ds=sidebyside posix_memalign should fail if size is not a multiple of sizeof(void *) --- diff --git a/src/malloc/posix_memalign.c b/src/malloc/posix_memalign.c index ef86260d..2ae928c8 100644 --- a/src/malloc/posix_memalign.c +++ b/src/malloc/posix_memalign.c @@ -11,7 +11,7 @@ int posix_memalign(void **res, size_t align, size_t len) unsigned char *mem, *new, *end; 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 (align <= 4*sizeof(size_t)) {