Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
The Tor Project
Core
Tor
Commits
951d59d7
Commit
951d59d7
authored
Jul 10, 2018
by
Nick Mathewson
🎨
Browse files
Use tor_getline() in dirserv.c to remove its upper line limit.
Closes ticket 26223.
parent
6574d4bd
Changes
2
Hide whitespace changes
Inline
Side-by-side
changes/bug26223
0 → 100644
View file @
951d59d7
o Minor features (directory authority):
- There is no longer an artificial upper limit on the length of bandwidth
lines. Closes ticket 26223.
src/feature/dircache/dirserv.c
View file @
951d59d7
...
...
@@ -2606,7 +2606,6 @@ int
dirserv_read_measured_bandwidths
(
const
char
*
from_file
,
smartlist_t
*
routerstatuses
)
{
char
line
[
512
];
FILE
*
fp
=
tor_fopen_cloexec
(
from_file
,
"r"
);
int
applied_lines
=
0
;
time_t
file_time
,
now
;
...
...
@@ -2617,9 +2616,10 @@ dirserv_read_measured_bandwidths(const char *from_file,
* version 1.1.0 */
int
line_is_after_headers
=
0
;
int
rv
=
-
1
;
char
*
line
=
NULL
;
size_t
n
=
0
;
/* Initialise line, so that we can't possibly run off the end. */
memset
(
line
,
0
,
sizeof
(
line
));
if
(
fp
==
NULL
)
{
log_warn
(
LD_CONFIG
,
"Can't open bandwidth file at configured location: %s"
,
...
...
@@ -2628,7 +2628,7 @@ dirserv_read_measured_bandwidths(const char *from_file,
}
/* If fgets fails, line is either unmodified, or indeterminate. */
if
(
!
f
get
s
(
line
,
sizeof
(
line
),
fp
)
)
{
if
(
tor_
getline
(
&
line
,
&
n
,
fp
)
<=
0
)
{
log_warn
(
LD_DIRSERV
,
"Empty bandwidth file"
);
goto
err
;
}
...
...
@@ -2659,7 +2659,7 @@ dirserv_read_measured_bandwidths(const char *from_file,
while
(
!
feof
(
fp
))
{
measured_bw_line_t
parsed_line
;
if
(
f
get
s
(
line
,
sizeof
(
line
),
fp
)
&&
strlen
(
line
)
)
{
if
(
tor_
getline
(
&
line
,
&
n
,
fp
)
>=
0
)
{
if
(
measured_bw_line_parse
(
&
parsed_line
,
line
,
line_is_after_headers
)
!=
-
1
)
{
/* This condition will be true when the first complete valid bw line
...
...
@@ -2682,6 +2682,8 @@ dirserv_read_measured_bandwidths(const char *from_file,
rv
=
0
;
err:
if
(
line
)
raw_free
(
line
);
if
(
fp
)
fclose
(
fp
);
return
rv
;
...
...
Write
Preview
Supports
Markdown
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