Fix broken parsing of malformed long option names as short names.
authorMatthias Bolte <matthias.bolte@googlemail.com>
Thu, 9 Apr 2009 17:43:20 +0000 (19:43 +0200)
committerMatthias Bolte <matthias.bolte@googlemail.com>
Thu, 9 Apr 2009 17:43:20 +0000 (19:43 +0200)
Signed-off-by: Matthias Bolte <matthias.bolte@googlemail.com>

cli/option.c

index 3a39c99..3f9baa5 100644 (file)
@@ -123,6 +123,12 @@ _vsc_cli_option_parse (struct VscError *error,
        }
 
        if (num_dashes > 0) {
+               if (num_dashes == 1 && *(token + 2) != '\0') {
+                       VSC__ERROR2 (error, VSC__ERROR_CODE__INTERNAL_ERROR,
+                                    "Invalid option syntax: %s", token);
+                       goto failure;
+               }
+
                option_info = _vsc_cli_option_infos_lookup
                                 (option_infos, token + num_dashes, num_dashes > 1);