]> granicus.if.org Git - musl/commitdiff
fix the use of syscall result in dl_mmap
authorIlya Matveychikov <matvejchikov@gmail.com>
Sat, 9 Feb 2019 14:56:17 +0000 (18:56 +0400)
committerRich Felker <dalias@aerifal.cx>
Sat, 6 Apr 2019 13:38:49 +0000 (09:38 -0400)
ldso/dynlink.c

index 206427fee67c5574f72fa5c4c4c6371709c32a40..7cb66db972ebbaa070c5c6a572478c9083d4ae3a 100644 (file)
@@ -920,7 +920,7 @@ static void *dl_mmap(size_t n)
 #else
        p = (void *)__syscall(SYS_mmap, 0, n, prot, flags, -1, 0);
 #endif
-       return p == MAP_FAILED ? 0 : p;
+       return (unsigned long)p > -4096UL ? 0 : p;
 }
 
 static void makefuncdescs(struct dso *p)