summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/device.c4
-rw-r--r--src/image.c2
-rw-r--r--src/main.c3
3 files changed, 4 insertions, 5 deletions
diff --git a/src/device.c b/src/device.c
index 593e4b9..d4a80d7 100644
--- a/src/device.c
+++ b/src/device.c
@@ -51,7 +51,7 @@ enum device device_from_string(const char * device) {
const char * device_to_string(enum device device) {
- if ( device > sizeof(devices)/sizeof(devices[0]) )
+ if ( device >= sizeof(devices)/sizeof(devices[0]) )
return NULL;
return devices[device];
@@ -68,7 +68,7 @@ static const char * long_devices[] = {
const char * device_to_long_string(enum device device) {
- if ( device > sizeof(long_devices)/sizeof(long_devices[0]) )
+ if ( device >= sizeof(long_devices)/sizeof(long_devices[0]) )
return NULL;
return long_devices[device];
diff --git a/src/image.c b/src/image.c
index 5f86e3b..994e3d0 100644
--- a/src/image.c
+++ b/src/image.c
@@ -540,7 +540,7 @@ enum image_type image_type_from_string(const char * type) {
const char * image_type_to_string(enum image_type type) {
- if ( type > sizeof(image_types)/sizeof(image_types[0]) )
+ if ( type >= sizeof(image_types)/sizeof(image_types[0]) )
return NULL;
return image_types[type];
diff --git a/src/main.c b/src/main.c
index 3616470..e5c71ae 100644
--- a/src/main.c
+++ b/src/main.c
@@ -300,7 +300,7 @@ static const char * image_tmp[] = {
static const char * image_tmp_name(enum image_type type) {
- if ( type > sizeof(image_tmp)/sizeof(image_tmp[0]) )
+ if ( type >= sizeof(image_tmp)/sizeof(image_tmp[0]) )
return NULL;
if ( ! image_tmp[type] || ! image_tmp[type][0] )
@@ -1288,7 +1288,6 @@ int main(int argc, char **argv) {
}
-
}
}