Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
22a19f5b
Commit
22a19f5b
authored
Feb 22, 2016
by
Edward Thomson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
git_libgit2_opts: introduce `GIT_OPT_ENABLE_STRICT_OBJECT_CREATION`
parent
6cc4bac8
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
0 deletions
+19
-0
include/git2/common.h
+9
-0
src/object.c
+2
-0
src/object.h
+2
-0
src/settings.c
+6
-0
No files found.
include/git2/common.h
View file @
22a19f5b
...
...
@@ -147,6 +147,7 @@ typedef enum {
GIT_OPT_SET_TEMPLATE_PATH
,
GIT_OPT_SET_SSL_CERT_LOCATIONS
,
GIT_OPT_SET_USER_AGENT
,
GIT_OPT_ENABLE_STRICT_OBJECT_CREATION
,
}
git_libgit2_opt_t
;
/**
...
...
@@ -251,6 +252,14 @@ typedef enum {
* > - `user_agent` is the value that will be delivered as the
* > User-Agent header on HTTP requests.
*
* * opts(GIT_OPT_ENABLE_STRICT_OBJECT_CREATION, int enabled)
*
* > Enable strict input validation when creating new objects
* > to ensure that all inputs to the new objects are valid. For
* > example, when this is enabled, the parent(s) and tree inputs
* > will be validated when creating a new commit. This defaults
* > to disabled.
*
* @param option Option key
* @param ... value to set the option
* @return 0 on success, <0 on failure
...
...
src/object.c
View file @
22a19f5b
...
...
@@ -14,6 +14,8 @@
#include "blob.h"
#include "tag.h"
bool
git_object__strict_input_validation
=
false
;
typedef
struct
{
const
char
*
str
;
/* type name string */
size_t
size
;
/* size in bytes of the object structure */
...
...
src/object.h
View file @
22a19f5b
...
...
@@ -7,6 +7,8 @@
#ifndef INCLUDE_object_h__
#define INCLUDE_object_h__
extern
bool
git_object__strict_input_validation
;
/** Base git object for inheritance */
struct
git_object
{
git_cached_obj
cached
;
...
...
src/settings.c
View file @
22a19f5b
...
...
@@ -14,6 +14,7 @@
#include "sysdir.h"
#include "cache.h"
#include "global.h"
#include "object.h"
void
git_libgit2_version
(
int
*
major
,
int
*
minor
,
int
*
rev
)
{
...
...
@@ -181,6 +182,11 @@ int git_libgit2_opts(int key, ...)
}
break
;
case
GIT_OPT_ENABLE_STRICT_OBJECT_CREATION
:
git_object__strict_input_validation
=
(
va_arg
(
ap
,
int
)
!=
0
);
break
;
default:
giterr_set
(
GITERR_INVALID
,
"invalid option key"
);
error
=
-
1
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment