Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
liblongpath-rsync
Project
Project
Details
Activity
Releases
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
liblongpath
liblongpath-rsync
Commits
9a7532e5
Commit
9a7532e5
authored
Mar 26, 2010
by
Wayne Davison
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix directory-length overflow bug (7057).
parent
9b594a53
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
6 deletions
+14
-6
flist.c
flist.c
+14
-6
No files found.
flist.c
View file @
9a7532e5
...
...
@@ -1728,21 +1728,29 @@ static void send_directory(int f, struct file_list *flist, char *fbuf, int len,
}
p
=
fbuf
+
len
;
if
(
len
!=
1
||
*
fbuf
!=
'/'
)
if
(
len
==
1
&&
*
fbuf
==
'/'
)
remainder
=
MAXPATHLEN
-
1
;
else
if
(
len
<
MAXPATHLEN
-
1
)
{
*
p
++
=
'/'
;
*
p
=
'\0'
;
remainder
=
MAXPATHLEN
-
(
p
-
fbuf
);
*
p
=
'\0'
;
remainder
=
MAXPATHLEN
-
(
len
+
1
);
}
else
remainder
=
0
;
for
(
errno
=
0
,
di
=
readdir
(
d
);
di
;
errno
=
0
,
di
=
readdir
(
d
))
{
char
*
dname
=
d_name
(
di
);
if
(
dname
[
0
]
==
'.'
&&
(
dname
[
1
]
==
'\0'
||
(
dname
[
1
]
==
'.'
&&
dname
[
2
]
==
'\0'
)))
continue
;
if
(
strlcpy
(
p
,
dname
,
remainder
)
>=
remainder
)
{
unsigned
name_len
=
strlcpy
(
p
,
dname
,
remainder
);
if
(
name_len
>=
remainder
)
{
char
save
=
fbuf
[
len
];
fbuf
[
len
]
=
'\0'
;
io_error
|=
IOERR_GENERAL
;
rprintf
(
FERROR_XFER
,
"cannot send long-named file %s
\n
"
,
full_fname
(
fbuf
));
"filename overflows max-path len by %u: %s/%s
\n
"
,
name_len
-
remainder
+
1
,
fbuf
,
dname
);
fbuf
[
len
]
=
save
;
continue
;
}
if
(
dname
[
0
]
==
'\0'
)
{
...
...
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