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
f2c24713
Commit
f2c24713
authored
Jan 26, 2011
by
nulltoken
Committed by
Vicent Marti
Jan 29, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Made path prettifying functions return GIT_EINVALIDPATH instead of GIT_ERROR.
parent
2e6fd09c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
4 deletions
+8
-4
src/errors.c
+1
-0
src/fileops.c
+4
-4
src/git2/common.h
+3
-0
No files found.
src/errors.c
View file @
f2c24713
...
@@ -19,6 +19,7 @@ static struct {
...
@@ -19,6 +19,7 @@ static struct {
{
GIT_EFLOCKFAIL
,
"Failed to adquire or release a file lock"
},
{
GIT_EFLOCKFAIL
,
"Failed to adquire or release a file lock"
},
{
GIT_EZLIB
,
"The Z library failed to inflate/deflate an object's data"
},
{
GIT_EZLIB
,
"The Z library failed to inflate/deflate an object's data"
},
{
GIT_EBUSY
,
"The queried object is currently busy"
},
{
GIT_EBUSY
,
"The queried object is currently busy"
},
{
GIT_EINVALIDPATH
,
"The path is invalid"
},
};
};
const
char
*
git_strerror
(
int
num
)
const
char
*
git_strerror
(
int
num
)
...
...
src/fileops.c
View file @
f2c24713
...
@@ -438,7 +438,7 @@ int gitfo_prettify_dir_path(char *buffer_out, const char *path)
...
@@ -438,7 +438,7 @@ int gitfo_prettify_dir_path(char *buffer_out, const char *path)
*
buffer_out
=
'\0'
;
*
buffer_out
=
'\0'
;
len
=
retrieve_previous_path_component_start
(
buffer_out_start
);
len
=
retrieve_previous_path_component_start
(
buffer_out_start
);
if
(
len
<
GIT_SUCCESS
)
if
(
len
<
GIT_SUCCESS
)
return
GIT_E
RROR
;
return
GIT_E
INVALIDPATH
;
buffer_out
=
(
char
*
)
buffer_out_start
+
len
;
buffer_out
=
(
char
*
)
buffer_out_start
+
len
;
continue
;
continue
;
...
@@ -446,7 +446,7 @@ int gitfo_prettify_dir_path(char *buffer_out, const char *path)
...
@@ -446,7 +446,7 @@ int gitfo_prettify_dir_path(char *buffer_out, const char *path)
/* Guard against potential multiple dot path traversal (cf http://cwe.mitre.org/data/definitions/33.html) */
/* Guard against potential multiple dot path traversal (cf http://cwe.mitre.org/data/definitions/33.html) */
if
(
only_dots
&&
segment_len
>
0
)
if
(
only_dots
&&
segment_len
>
0
)
return
GIT_E
RROR
;
return
GIT_E
INVALIDPATH
;
*
buffer_out
++
=
'/'
;
*
buffer_out
++
=
'/'
;
len
++
;
len
++
;
...
@@ -467,7 +467,7 @@ int gitfo_prettify_file_path(char *buffer_out, const char *path)
...
@@ -467,7 +467,7 @@ int gitfo_prettify_file_path(char *buffer_out, const char *path)
/* Let's make sure the filename doesn't end with "/", "/." or "/.." */
/* Let's make sure the filename doesn't end with "/", "/." or "/.." */
for
(
i
=
1
;
path_len
>
i
&&
i
<
4
;
i
++
)
{
for
(
i
=
1
;
path_len
>
i
&&
i
<
4
;
i
++
)
{
if
(
!
strncmp
(
path
+
path_len
-
i
,
pattern
,
i
))
if
(
!
strncmp
(
path
+
path_len
-
i
,
pattern
,
i
))
return
GIT_E
RROR
;
return
GIT_E
INVALIDPATH
;
}
}
error
=
gitfo_prettify_dir_path
(
buffer_out
,
path
);
error
=
gitfo_prettify_dir_path
(
buffer_out
,
path
);
...
@@ -476,7 +476,7 @@ int gitfo_prettify_file_path(char *buffer_out, const char *path)
...
@@ -476,7 +476,7 @@ int gitfo_prettify_file_path(char *buffer_out, const char *path)
path_len
=
strlen
(
buffer_out
);
path_len
=
strlen
(
buffer_out
);
if
(
path_len
<
2
)
if
(
path_len
<
2
)
return
GIT_E
RROR
;
return
GIT_E
INVALIDPATH
;
/* Remove the trailing slash */
/* Remove the trailing slash */
buffer_out
[
path_len
-
1
]
=
'\0'
;
buffer_out
[
path_len
-
1
]
=
'\0'
;
...
...
src/git2/common.h
View file @
f2c24713
...
@@ -136,6 +136,9 @@
...
@@ -136,6 +136,9 @@
/** The index file is not backed up by an existing repository */
/** The index file is not backed up by an existing repository */
#define GIT_EBAREINDEX (GIT_ERROR -14)
#define GIT_EBAREINDEX (GIT_ERROR -14)
/** The path is invalid */
#define GIT_EINVALIDPATH (GIT_ERROR - 19)
GIT_BEGIN_DECL
GIT_BEGIN_DECL
/** @} */
/** @} */
GIT_END_DECL
GIT_END_DECL
...
...
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