}
static int probe_swap1(struct blkid_probe *probe,
- struct blkid_magic *id __BLKID_ATTR((unused)),
+ struct blkid_magic *id,
unsigned char *buf __BLKID_ATTR((unused)))
{
struct swap_id_block *sws;
if (!sws)
return 1;
+ /* check for wrong version or zeroed pagecount, for sanity */
+ if (!memcmp(id->bim_magic, "SWAPSPACE2", id->bim_len) &&
+ (blkid_le32(sws->sws_version) != 1 ||
+ sws->sws_lastpage == 0))
+ return 1;
+
/* arbitrary sanity check.. is there any garbage down there? */
if (sws->sws_pad[32] == 0 && sws->sws_pad[33] == 0) {
if (sws->sws_volume[0])