Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
nghttp2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
nghttp2
Commits
aea4001d
Commit
aea4001d
authored
Jun 05, 2014
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
deflatehd: Fix crash with -t option
parent
eb0a894e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
16 deletions
+14
-16
src/deflatehd.cc
src/deflatehd.cc
+14
-16
No files found.
src/deflatehd.cc
View file @
aea4001d
...
@@ -258,18 +258,16 @@ static int perform(void)
...
@@ -258,18 +258,16 @@ static int perform(void)
static
int
perform_from_http1text
(
void
)
static
int
perform_from_http1text
(
void
)
{
{
char
line
[
1
<<
14
];
char
line
[
1
<<
14
];
std
::
vector
<
nghttp2_nv
>
nva
;
int
seq
=
0
;
int
seq
=
0
;
nghttp2_hd_deflater
deflater
;
nghttp2_hd_deflater
deflater
;
init_deflater
(
&
deflater
);
init_deflater
(
&
deflater
);
output_json_header
();
output_json_header
();
for
(;;)
{
for
(;;)
{
s
ize_t
nvlen
=
0
;
s
td
::
vector
<
nghttp2_nv
>
nva
;
int
end
=
0
;
int
end
=
0
;
size_t
inputlen
=
0
;
size_t
inputlen
=
0
;
size_t
i
;
for
(;;)
{
for
(;;)
{
nghttp2_nv
*
nv
;
char
*
rv
=
fgets
(
line
,
sizeof
(
line
),
stdin
);
char
*
rv
=
fgets
(
line
,
sizeof
(
line
),
stdin
);
char
*
val
,
*
val_end
;
char
*
val
,
*
val_end
;
if
(
rv
==
nullptr
)
{
if
(
rv
==
nullptr
)
{
...
@@ -279,9 +277,9 @@ static int perform_from_http1text(void)
...
@@ -279,9 +277,9 @@ static int perform_from_http1text(void)
break
;
break
;
}
}
nva
.
resize
(
nvlen
);
nva
.
emplace_back
();
auto
&
nv
=
nva
.
back
();
nv
=
&
nva
[
nvlen
];
val
=
strchr
(
line
+
1
,
':'
);
val
=
strchr
(
line
+
1
,
':'
);
if
(
val
==
nullptr
)
{
if
(
val
==
nullptr
)
{
fprintf
(
stderr
,
"Bad HTTP/1 header field format at %d.
\n
"
,
seq
);
fprintf
(
stderr
,
"Bad HTTP/1 header field format at %d.
\n
"
,
seq
);
...
@@ -294,14 +292,13 @@ static int perform_from_http1text(void)
...
@@ -294,14 +292,13 @@ static int perform_from_http1text(void)
++
val_end
);
++
val_end
);
*
val_end
=
'\0'
;
*
val_end
=
'\0'
;
nv
->
namelen
=
strlen
(
line
);
nv
.
namelen
=
strlen
(
line
);
nv
->
valuelen
=
strlen
(
val
);
nv
.
valuelen
=
strlen
(
val
);
nv
->
name
=
(
uint8_t
*
)
strdup
(
line
);
nv
.
name
=
(
uint8_t
*
)
strdup
(
line
);
nv
->
value
=
(
uint8_t
*
)
strdup
(
val
);
nv
.
value
=
(
uint8_t
*
)
strdup
(
val
);
nv
->
flags
=
NGHTTP2_NV_FLAG_NONE
;
nv
.
flags
=
NGHTTP2_NV_FLAG_NONE
;
++
nvlen
;
inputlen
+=
nv
.
namelen
+
nv
.
valuelen
;
inputlen
+=
nv
->
namelen
+
nv
->
valuelen
;
}
}
if
(
!
end
)
{
if
(
!
end
)
{
...
@@ -311,10 +308,11 @@ static int perform_from_http1text(void)
...
@@ -311,10 +308,11 @@ static int perform_from_http1text(void)
deflate_hd
(
&
deflater
,
nva
,
inputlen
,
seq
);
deflate_hd
(
&
deflater
,
nva
,
inputlen
,
seq
);
}
}
for
(
i
=
0
;
i
<
nvlen
;
++
i
)
{
for
(
auto
&
nv
:
nva
)
{
free
(
nv
a
[
i
]
.
name
);
free
(
nv
.
name
);
free
(
nv
a
[
i
]
.
value
);
free
(
nv
.
value
);
}
}
if
(
end
)
break
;
if
(
end
)
break
;
++
seq
;
++
seq
;
}
}
...
...
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