chsmack: refusing repeated labels
authorJosé Bollo <jose.bollo@open.eurogiciel.org>
Tue, 10 Dec 2013 14:33:13 +0000 (15:33 +0100)
committerJosé Bollo <jose.bollo@open.eurogiciel.org>
Tue, 17 Dec 2013 11:21:50 +0000 (12:21 +0100)
Refusing to set many time a label is important for
security. If a label is set more than one time, wich
label is to use? Wich is the good?

Signed-off-by: José Bollo <jose.bollo@open.eurogiciel.org>
utils/chsmack.c

index 11ea2f6..b4aea3c 100644 (file)
@@ -209,6 +209,11 @@ int main(int argc, char *argv[])
                                continue;
                }
 
+               if (labelset->isset) {
+                       fprintf(stderr, "%s: %s: option set many times.\n",
+                               basename(argv[0]), options[options_map[c]].name);
+                       exit(1);
+               }
                /* greedy on optional arguments */
                if (optarg == NULL && argv[optind] != NULL && argv[optind][0] != '-') {
                        optarg = argv[optind++];