Index: head/lib/libc/stdlib/getopt_long.c =================================================================== --- head/lib/libc/stdlib/getopt_long.c +++ head/lib/libc/stdlib/getopt_long.c @@ -481,6 +481,8 @@ #endif if (*place == '-') { place++; /* --foo long option */ + if (*place == '\0') + return (BADARG); /* malformed option */ #ifdef GNU_COMPATIBLE dash_prefix = DD_PREFIX; #endif