swaponoff: prevent arithmetic overflow (spotted by Paul Fox <pgf@brightstareng.com>)
authorvda <vda@69ca8d6d-28ef-0310-b511-8ec308f3f277>
Mon, 5 Nov 2007 19:33:38 +0000 (19:33 +0000)
committervda <vda@69ca8d6d-28ef-0310-b511-8ec308f3f277>
Mon, 5 Nov 2007 19:33:38 +0000 (19:33 +0000)
git-svn-id: svn://busybox.net/trunk/busybox@20368 69ca8d6d-28ef-0310-b511-8ec308f3f277

util-linux/swaponoff.c

index 6858d26..48f6f4e 100644 (file)
@@ -21,7 +21,7 @@ static int swap_enable_disable(char *device)
 #if ENABLE_DESKTOP
        /* test for holes */
        if (S_ISREG(st.st_mode))
-               if (st.st_blocks * 512 < st.st_size)
+               if (st.st_blocks * (off_t)512 < st.st_size)
                        bb_error_msg("warning: swap file has holes");
 #endif