[PATCH] libfdisk: fix range checking for fdisk_set_last_lba

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



---
 libfdisk/src/context.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libfdisk/src/context.c b/libfdisk/src/context.c
index 26f526a..ab4709c 100644
--- a/libfdisk/src/context.c
+++ b/libfdisk/src/context.c
@@ -1012,7 +1012,7 @@ fdisk_sector_t fdisk_set_last_lba(struct fdisk_context *cxt, fdisk_sector_t lba)
 {
 	assert(cxt);
 
-	if (lba > cxt->total_sectors - 1 && lba < 1)
+	if (lba > cxt->total_sectors - 1 || lba < 1)
 		return -ERANGE;
 	cxt->last_lba = lba;
 	return 0;
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux