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
e64bc7cd
Commit
e64bc7cd
authored
10 years ago
by
Patrick Monnerat
Browse files
Options
Downloads
Patches
Plain Diff
OS400: fix bugs in curl_*escape_ccsid() and reduce variables scope
parent
473322ec
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
packages/OS400/ccsidcurl.c
+18
-23
18 additions, 23 deletions
packages/OS400/ccsidcurl.c
packages/OS400/os400sys.c
+3
-6
3 additions, 6 deletions
packages/OS400/os400sys.c
with
21 additions
and
29 deletions
packages/OS400/ccsidcurl.c
+
18
−
23
View file @
e64bc7cd
...
...
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 201
3
, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 201
4
, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
...
...
@@ -167,7 +167,6 @@ dynconvert(int dccsid, const char * s, int slen, int sccsid)
char
*
cp
;
size_t
dlen
;
int
l
;
int
l2
;
static
const
char
nullbyte
=
0
;
/* Like convert, but the destination is allocated and returned. */
...
...
@@ -191,7 +190,7 @@ dynconvert(int dccsid, const char * s, int slen, int sccsid)
Since destination code size is unknown, use a conversion to generate
terminator. */
l2
=
convert
(
d
+
l
,
dlen
-
l
,
dccsid
,
&
nullbyte
,
-
1
,
ASCII_CCSID
);
int
l2
=
convert
(
d
+
l
,
dlen
-
l
,
dccsid
,
&
nullbyte
,
-
1
,
ASCII_CCSID
);
if
(
l2
<
0
)
{
free
(
d
);
...
...
@@ -217,10 +216,11 @@ slist_convert(int dccsid, struct curl_slist * from, int sccsid)
{
struct
curl_slist
*
to
=
(
struct
curl_slist
*
)
NULL
;
char
*
cp
;
for
(;
from
;
from
=
from
->
next
)
{
if
(
!
(
cp
=
dynconvert
(
dccsid
,
from
->
data
,
-
1
,
sccsid
)))
{
char
*
cp
=
dynconvert
(
dccsid
,
from
->
data
,
-
1
,
sccsid
);
if
(
!
cp
)
{
curl_slist_free_all
(
to
);
return
(
struct
curl_slist
*
)
NULL
;
}
...
...
@@ -269,7 +269,7 @@ curl_easy_escape_ccsid(CURL * handle, const char * string, int length,
return
(
char
*
)
NULL
;
}
s
=
dynconvert
(
ASCII_CCSID
,
s
,
length
?
length
:
-
1
,
sccsid
);
s
=
dynconvert
(
ASCII_CCSID
,
s
tring
,
length
?
length
:
-
1
,
sccsid
);
if
(
!
s
)
return
(
char
*
)
NULL
;
...
...
@@ -300,7 +300,7 @@ curl_easy_unescape_ccsid(CURL * handle, const char * string, int length,
return
(
char
*
)
NULL
;
}
s
=
dynconvert
(
ASCII_CCSID
,
s
,
length
?
length
:
-
1
,
sccsid
);
s
=
dynconvert
(
ASCII_CCSID
,
s
tring
,
length
?
length
:
-
1
,
sccsid
);
if
(
!
s
)
return
(
char
*
)
NULL
;
...
...
@@ -370,15 +370,13 @@ convert_version_info_string(const char * * stringp,
char
*
*
bufp
,
int
*
left
,
unsigned
int
ccsid
)
{
int
l
;
/* Helper for curl_version_info_ccsid(): convert a string if defined.
Result is stored in the `*left'-byte buffer at `*bufp'.
`*bufp' and `*left' are updated accordingly.
Return 0 if ok, else -1. */
if
(
*
stringp
)
{
l
=
convert
(
*
bufp
,
*
left
,
ccsid
,
*
stringp
,
-
1
,
ASCII_CCSID
);
int
l
=
convert
(
*
bufp
,
*
left
,
ccsid
,
*
stringp
,
-
1
,
ASCII_CCSID
);
if
(
l
<=
0
)
return
-
1
;
...
...
@@ -400,7 +398,6 @@ curl_version_info_ccsid(CURLversion stamp, unsigned int ccsid)
char
*
cp
;
int
n
;
int
nproto
;
int
i
;
curl_version_info_data
*
id
;
/* The assertion below is possible, because although the second operand
...
...
@@ -473,8 +470,9 @@ curl_version_info_ccsid(CURLversion stamp, unsigned int ccsid)
memcpy
((
char
*
)
id
,
(
char
*
)
p
,
sizeof
*
p
);
if
(
id
->
protocols
)
{
int
i
=
nproto
*
sizeof
id
->
protocols
[
0
];
id
->
protocols
=
(
const
char
*
const
*
)
cp
;
i
=
nproto
*
sizeof
id
->
protocols
[
0
];
memcpy
(
cp
,
(
char
*
)
p
->
protocols
,
i
);
cp
+=
i
;
n
-=
i
;
...
...
@@ -589,11 +587,11 @@ void
curl_certinfo_free_all
(
struct
curl_certinfo
*
info
)
{
int
i
;
/* Free all memory used by certificate info. */
if
(
info
)
{
if
(
info
->
certinfo
)
{
int
i
;
for
(
i
=
0
;
i
<
info
->
num_of_certs
;
i
++
)
curl_slist_free_all
(
info
->
certinfo
[
i
]);
free
((
char
*
)
info
->
certinfo
);
...
...
@@ -612,13 +610,10 @@ curl_easy_getinfo_ccsid(CURL * curl, CURLINFO info, ...)
CURLcode
ret
;
unsigned
int
ccsid
;
char
*
*
cpp
;
char
*
s
;
char
*
d
;
struct
SessionHandle
*
data
;
struct
curl_slist
*
*
slp
;
struct
curl_certinfo
*
cipf
;
struct
curl_certinfo
*
cipt
;
int
i
;
/* WARNING: unlike curl_easy_get_info(), the strings returned by this
procedure have to be free'ed. */
...
...
@@ -634,13 +629,11 @@ curl_easy_getinfo_ccsid(CURL * curl, CURLINFO info, ...)
case
CURLINFO_STRING
:
ccsid
=
va_arg
(
arg
,
unsigned
int
);
cpp
=
(
char
*
*
)
paramp
;
s
=
*
cpp
;
if
(
s
)
{
d
=
dynconvert
(
ccsid
,
s
,
-
1
,
ASCII_CCSID
);
*
cpp
=
d
;
if
(
*
cpp
)
{
*
cpp
=
dynconvert
(
ccsid
,
*
cpp
,
-
1
,
ASCII_CCSID
);
if
(
!
d
)
if
(
!
*
cpp
)
ret
=
CURLE_OUT_OF_MEMORY
;
}
...
...
@@ -661,6 +654,8 @@ curl_easy_getinfo_ccsid(CURL * curl, CURLINFO info, ...)
if
(
!
cipt
->
certinfo
)
ret
=
CURLE_OUT_OF_MEMORY
;
else
{
int
i
;
cipt
->
num_of_certs
=
cipf
->
num_of_certs
;
for
(
i
=
0
;
i
<
cipf
->
num_of_certs
;
i
++
)
if
(
cipf
->
certinfo
[
i
])
...
...
@@ -1107,7 +1102,6 @@ curl_easy_setopt_ccsid(CURL * curl, CURLoption tag, ...)
char
*
s
;
char
*
cp
;
unsigned
int
ccsid
;
size_t
len
;
curl_off_t
pfsize
;
static
char
testwarn
=
1
;
...
...
@@ -1228,6 +1222,7 @@ curl_easy_setopt_ccsid(CURL * curl, CURLoption tag, ...)
}
else
{
/* Data length specified. */
size_t
len
;
if
(
pfsize
<
0
||
pfsize
>
SIZE_MAX
)
{
result
=
CURLE_OUT_OF_MEMORY
;
...
...
This diff is collapsed.
Click to expand it.
packages/OS400/os400sys.c
+
3
−
6
View file @
e64bc7cd
...
...
@@ -94,11 +94,9 @@ static void
thdbufdestroy
(
void
*
private
)
{
localkey_t
i
;
buffer_t
*
p
;
if
(
private
)
{
p
=
(
buffer_t
*
)
private
;
buffer_t
*
p
=
(
buffer_t
*
)
private
;
localkey_t
i
;
for
(
i
=
(
localkey_t
)
0
;
i
<
LK_LAST
;
i
++
)
{
if
(
p
->
buf
)
...
...
@@ -1095,14 +1093,13 @@ struct berval * *
Curl_ldap_get_values_len_a
(
void
*
ld
,
LDAPMessage
*
entry
,
const
char
*
attr
)
{
int
i
;
char
*
cp
;
struct
berval
*
*
result
;
cp
=
(
char
*
)
NULL
;
if
(
attr
)
{
i
=
strlen
(
attr
);
int
i
=
strlen
(
attr
);
if
(
!
(
cp
=
malloc
(
i
+
1
)))
{
ldap_set_lderrno
(
ld
,
LDAP_NO_MEMORY
,
NULL
,
...
...
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