summaryrefslogtreecommitdiff
authorChristophe Grenier <grenier@cgsecurity.org>2010-05-21 07:17:55 (GMT)
committer Christophe Grenier <grenier@cgsecurity.org>2010-05-21 07:17:55 (GMT)
commit76dffac4ca51aa1e79130a3c4752a429e3a086e0 (patch)
tree82764e9e113bda707960315128f12fcb160e55e7
parent21d47fea5168186938a4187055afe1d4d042977e (diff)
Another fix for DCO/HPA detection
Diffstat
-rw-r--r--src/hidden.c4
-rw-r--r--src/hiddenn.c5
2 files changed, 5 insertions, 4 deletions
diff --git a/src/hidden.c b/src/hidden.c
index 556bbfa..c167005 100644
--- a/src/hidden.c
+++ b/src/hidden.c
@@ -37,8 +37,8 @@ int is_hpa_or_dco(const disk_t *disk)
log_warning("%s: Host Protected Area (HPA) present.\n", disk->device);
res=1;
}
- if((disk->native_max > 0 && disk->native_max < disk->dco) ||
- (disk->user_max > 0 && disk->user_max < disk->dco))
+ if((disk->native_max > 0 && disk->user_max < disk->native_max+1 && disk->native_max < disk->dco) ||
+ (disk->user_max > 0 && disk->user_max < disk->dco+1))
{
log_warning("%s: Device Configuration Overlay (DCO) present.\n", disk->device);
res=1;
diff --git a/src/hiddenn.c b/src/hiddenn.c
index 2e45343..5931fc0 100644
--- a/src/hiddenn.c
+++ b/src/hiddenn.c
@@ -69,12 +69,13 @@ int interface_check_hidden_ncurses(disk_t *disk)
wmove(stdscr,line++,0);
wprintw(stdscr, "dco %llu sectors\n", (long long unsigned)(disk->dco+1));
}
- if(disk->user_max < disk->native_max+1)
+ if(disk->user_max > 0 && disk->user_max < disk->native_max+1)
{
wmove(stdscr,line++,0);
wprintw(stdscr, "Host Protected Area (HPA) present.\n");
}
- if(disk->native_max!=0 && disk->native_max < disk->dco)
+ if((disk->native_max > 0 && disk->user_max < disk->native_max+1 && disk->native_max < disk->dco) ||
+ (disk->user_max > 0 && disk->user_max < disk->dco+1))
{
wmove(stdscr,line,0);
wprintw(stdscr, "Device Configuration Overlay (DCO) present.\n");