Commit 7bab2e8f by Edward Thomson

git_libgit2_opts: validate key

parent 5bc93eae
......@@ -181,6 +181,9 @@ int git_libgit2_opts(int key, ...)
}
break;
default:
giterr_set(GITERR_INVALID, "invalid option key");
error = -1;
}
va_end(ap);
......
......@@ -17,3 +17,9 @@ void test_core_opts__readwrite(void)
cl_assert(new_val == old_val);
}
void test_core_opts__invalid_option(void)
{
cl_git_fail(git_libgit2_opts(-1, "foobar"));
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment