Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
TLMSP curl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
CYBER - Cyber Security
TS 103 523 MSP
TLMSP
TLMSP curl
Commits
c11a1bf7
Commit
c11a1bf7
authored
23 years ago
by
Daniel Stenberg
Browse files
Options
Downloads
Patches
Plain Diff
made some char * into const char * and I removed the check for size > 0
in the add_buffer function.
parent
f1955020
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/http.c
+20
-22
20 additions, 22 deletions
lib/http.c
with
20 additions
and
22 deletions
lib/http.c
+
20
−
22
View file @
c11a1bf7
...
...
@@ -104,7 +104,7 @@
* be sent in one go.
*/
static
CURLcode
add_buffer
(
send_buffer
*
in
,
void
*
inptr
,
size_t
size
);
add_buffer
(
send_buffer
*
in
,
const
void
*
inptr
,
size_t
size
);
/*
* add_buffer_init() returns a fine buffer struct
...
...
@@ -148,7 +148,7 @@ size_t add_buffer_send(int sockfd, struct connectdata *conn, send_buffer *in)
* add_bufferf() builds a buffer from the formatted input
*/
static
CURLcode
add_bufferf
(
send_buffer
*
in
,
char
*
fmt
,
...)
CURLcode
add_bufferf
(
send_buffer
*
in
,
const
char
*
fmt
,
...)
{
CURLcode
result
=
CURLE_OUT_OF_MEMORY
;
char
*
s
;
...
...
@@ -168,32 +168,30 @@ CURLcode add_bufferf(send_buffer *in, char *fmt, ...)
* add_buffer() appends a memory chunk to the existing one
*/
static
CURLcode
add_buffer
(
send_buffer
*
in
,
void
*
inptr
,
size_t
size
)
CURLcode
add_buffer
(
send_buffer
*
in
,
const
void
*
inptr
,
size_t
size
)
{
char
*
new_rb
;
int
new_size
;
if
(
size
>
0
)
{
if
(
!
in
->
buffer
||
((
in
->
size_used
+
size
)
>
(
in
->
size_max
-
1
)))
{
new_size
=
(
in
->
size_used
+
size
)
*
2
;
if
(
in
->
buffer
)
/* we have a buffer, enlarge the existing one */
new_rb
=
(
char
*
)
realloc
(
in
->
buffer
,
new_size
);
else
/* create a new buffer */
new_rb
=
(
char
*
)
malloc
(
new_size
);
if
(
!
in
->
buffer
||
((
in
->
size_used
+
size
)
>
(
in
->
size_max
-
1
)))
{
new_size
=
(
in
->
size_used
+
size
)
*
2
;
if
(
in
->
buffer
)
/* we have a buffer, enlarge the existing one */
new_rb
=
(
char
*
)
realloc
(
in
->
buffer
,
new_size
);
else
/* create a new buffer */
new_rb
=
(
char
*
)
malloc
(
new_size
);
if
(
!
new_rb
)
return
CURLE_OUT_OF_MEMORY
;
if
(
!
new_rb
)
return
CURLE_OUT_OF_MEMORY
;
in
->
buffer
=
new_rb
;
in
->
size_max
=
new_size
;
}
memcpy
(
&
in
->
buffer
[
in
->
size_used
],
inptr
,
size
);
in
->
size_used
+=
size
;
in
->
buffer
=
new_rb
;
in
->
size_max
=
new_size
;
}
memcpy
(
&
in
->
buffer
[
in
->
size_used
],
inptr
,
size
);
in
->
size_used
+=
size
;
return
CURLE_OK
;
}
...
...
@@ -240,7 +238,7 @@ int GetLine(int sockfd, char *buf, struct connectdata *conn)
* This function checks the linked list of custom HTTP headers for a particular
* header (prefix).
*/
bool
static
checkheaders
(
struct
UrlData
*
data
,
char
*
thisheader
)
static
bool
checkheaders
(
struct
UrlData
*
data
,
const
char
*
thisheader
)
{
struct
curl_slist
*
head
;
size_t
thislen
=
strlen
(
thisheader
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment