about summary refs log tree commit diff
path: root/src/malloc/posix_memalign.c
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2011-06-29 19:26:30 -0400
committerRich Felker <dalias@aerifal.cx>2011-06-29 19:26:30 -0400
commitf9ed11f3e1337d6bac6298db1d66d4f27bb59f6b (patch)
tree333f2524b56bff65277f51589b572a04f0fa4d5d /src/malloc/posix_memalign.c
parent47e72e10d5e1c7e88b8e419586baf55b12141446 (diff)
downloadmusl-f9ed11f3e1337d6bac6298db1d66d4f27bb59f6b.tar.gz
musl-f9ed11f3e1337d6bac6298db1d66d4f27bb59f6b.tar.xz
musl-f9ed11f3e1337d6bac6298db1d66d4f27bb59f6b.zip
posix_memalign should fail if size is not a multiple of sizeof(void *)
Diffstat (limited to 'src/malloc/posix_memalign.c')
-rw-r--r--src/malloc/posix_memalign.c2
1 files changed, 1 insertions, 1 deletions
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)) {