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 3c963e22a20ec2e734fc7700eecda1207743efe4..59ec5b79124b70a3d184b54d60b4303529428f56 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;