]> git.ipfire.org Git - thirdparty/git.git/blobdiff - parse-options-cb.c
parse-options: check empty value in OPT_INTEGER and OPT_ABBREV
[thirdparty/git.git] / parse-options-cb.c
index 2733393546d4d4dd9a55c5934531398f4a827ead..02293493b01a5a9e91c54da9833a583ea1c643b3 100644 (file)
@@ -16,6 +16,9 @@ int parse_opt_abbrev_cb(const struct option *opt, const char *arg, int unset)
        if (!arg) {
                v = unset ? 0 : DEFAULT_ABBREV;
        } else {
+               if (!*arg)
+                       return error(_("option `%s' expects a numerical value"),
+                                    opt->long_name);
                v = strtol(arg, (char **)&arg, 10);
                if (*arg)
                        return error(_("option `%s' expects a numerical value"),