--- src/file.c +++ src/file.c 2014-02-18 08:50:59.990452075 +0000 @@ -198,6 +198,8 @@ main(int argc, char *argv[]) flags |= MAGIC_ERROR; break; case 'e': + if (!optarg) + usage(); for (i = 0; i < sizeof(nv) / sizeof(nv[0]); i++) if (strcmp(nv[i].name, optarg) == 0) break; @@ -209,7 +211,7 @@ main(int argc, char *argv[]) break; case 'f': - if(action) + if(action || !optarg) usage(); if (magic == NULL) if ((magic = load(magicfile, flags)) == NULL) @@ -218,6 +220,8 @@ main(int argc, char *argv[]) ++didsomefiles; break; case 'F': + if (!optarg) + usage(); separator = optarg; break; case 'i': @@ -230,6 +234,8 @@ main(int argc, char *argv[]) action = FILE_LIST; break; case 'm': + if (!optarg) + usage(); magicfile = optarg; break; case 'n':