File tree 4 files changed +19
-0
lines changed
4 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -147,6 +147,7 @@ typedef enum {
147
147
GIT_OPT_SET_TEMPLATE_PATH ,
148
148
GIT_OPT_SET_SSL_CERT_LOCATIONS ,
149
149
GIT_OPT_SET_USER_AGENT ,
150
+ GIT_OPT_ENABLE_STRICT_OBJECT_CREATION ,
150
151
} git_libgit2_opt_t ;
151
152
152
153
/**
@@ -251,6 +252,14 @@ typedef enum {
251
252
* > - `user_agent` is the value that will be delivered as the
252
253
* > User-Agent header on HTTP requests.
253
254
*
255
+ * * opts(GIT_OPT_ENABLE_STRICT_OBJECT_CREATION, int enabled)
256
+ *
257
+ * > Enable strict input validation when creating new objects
258
+ * > to ensure that all inputs to the new objects are valid. For
259
+ * > example, when this is enabled, the parent(s) and tree inputs
260
+ * > will be validated when creating a new commit. This defaults
261
+ * > to disabled.
262
+ *
254
263
* @param option Option key
255
264
* @param ... value to set the option
256
265
* @return 0 on success, <0 on failure
Original file line number Diff line number Diff line change 14
14
#include "blob.h"
15
15
#include "tag.h"
16
16
17
+ bool git_object__strict_input_validation = false;
18
+
17
19
typedef struct {
18
20
const char * str ; /* type name string */
19
21
size_t size ; /* size in bytes of the object structure */
Original file line number Diff line number Diff line change 7
7
#ifndef INCLUDE_object_h__
8
8
#define INCLUDE_object_h__
9
9
10
+ extern bool git_object__strict_input_validation ;
11
+
10
12
/** Base git object for inheritance */
11
13
struct git_object {
12
14
git_cached_obj cached ;
Original file line number Diff line number Diff line change 14
14
#include "sysdir.h"
15
15
#include "cache.h"
16
16
#include "global.h"
17
+ #include "object.h"
17
18
18
19
void git_libgit2_version (int * major , int * minor , int * rev )
19
20
{
@@ -181,6 +182,11 @@ int git_libgit2_opts(int key, ...)
181
182
}
182
183
183
184
break ;
185
+
186
+ case GIT_OPT_ENABLE_STRICT_OBJECT_CREATION :
187
+ git_object__strict_input_validation = (va_arg (ap , int ) != 0 );
188
+ break ;
189
+
184
190
default :
185
191
giterr_set (GITERR_INVALID , "invalid option key" );
186
192
error = -1 ;
You can’t perform that action at this time.
0 commit comments