fix bug where read error was treated as success reading library headers
authorRich Felker <dalias@aerifal.cx>
Wed, 31 Jul 2013 18:05:41 +0000 (14:05 -0400)
committerRich Felker <dalias@aerifal.cx>
Wed, 31 Jul 2013 18:05:41 +0000 (14:05 -0400)
src/ldso/dynlink.c

index 3c963e2..59ec5b7 100644 (file)
@@ -318,7 +318,7 @@ static void *map_library(int fd, struct dso *dso)
        size_t i;
 
        ssize_t l = read(fd, buf, sizeof buf);
-       if (l<sizeof *eh) return 0;
+       if (l<(int)sizeof *eh) return 0;
        eh = buf;
        phsize = eh->e_phentsize * eh->e_phnum;
        if (phsize + sizeof *eh > l) return 0;