summaryrefslogtreecommitdiffstats
path: root/src/hidden.c
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2009-07-03 08:01:35 +0200
committerChristophe Grenier <grenier@cgsecurity.org>2009-07-03 08:01:35 +0200
commit08508476ebea7d51e9fdc7433abc1618f15f24e5 (patch)
treec5b6fb9aa8b0ce0b98f06090845bc04a385c5812 /src/hidden.c
parent389f2b1e33e951c22cd45ce78c3df1f61a7d9b59 (diff)
HPA/DOC detection, handle the case where native_max is null.
Diffstat (limited to 'src/hidden.c')
-rw-r--r--src/hidden.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/hidden.c b/src/hidden.c
index 260784a..d1d776f 100644
--- a/src/hidden.c
+++ b/src/hidden.c
@@ -31,14 +31,19 @@
int is_hpa_or_dco(const disk_t *disk)
{
- if(disk->user_max>0 && (disk->user_max < disk->native_max+1 || disk->native_max < disk->dco))
+ int res=0;
+ if(disk->user_max > 0 && disk->user_max < disk->native_max+1)
{
- if(disk->user_max < disk->native_max+1)
- log_warning("%s: Host Protected Area (HPA) present.\n", disk->device);
- if(disk->native_max < disk->dco)
- log_warning("%s: Device Configuration Overlay (DCO) present.\n", disk->device);
- log_flush();
- return 1;
+ log_warning("%s: Host Protected Area (HPA) present.\n", disk->device);
+ res=1;
+ }
+ if((disk->user_max> 0 && disk->native_max < disk->dco) ||
+ (disk->native_max == 0 && disk->user_max > 0 && disk->user_max < disk->dco))
+ {
+ log_warning("%s: Device Configuration Overlay (DCO) present.\n", disk->device);
+ res=1;
}
- return 0;
+ if(res>0)
+ log_flush();
+ return res;
}