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
31e106ce
Commit
31e106ce
authored
15 years ago
by
Yang Tse
Browse files
Options
Downloads
Patches
Plain Diff
Attempt to silence bogus compiler warning: "Potential null pointer dereference"
parent
250ba994
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
ares/ares_getnameinfo.c
+9
-10
9 additions, 10 deletions
ares/ares_getnameinfo.c
ares/ares_init.c
+6
-3
6 additions, 3 deletions
ares/ares_init.c
lib/url.c
+5
-3
5 additions, 3 deletions
lib/url.c
tests/server/sws.c
+1
-0
1 addition, 0 deletions
tests/server/sws.c
with
21 additions
and
16 deletions
ares/ares_getnameinfo.c
+
9
−
10
View file @
31e106ce
...
...
@@ -99,12 +99,19 @@ void ares_getnameinfo(ares_channel channel, const struct sockaddr *sa,
struct
sockaddr_in
*
addr
=
NULL
;
struct
sockaddr_in6
*
addr6
=
NULL
;
struct
nameinfo_query
*
niquery
;
unsigned
int
port
=
0
;
/* Verify the buffer size */
if
(
salen
==
sizeof
(
struct
sockaddr_in
))
addr
=
(
struct
sockaddr_in
*
)
sa
;
{
addr
=
(
struct
sockaddr_in
*
)
sa
;
port
=
addr
->
sin_port
;
}
else
if
(
salen
==
sizeof
(
struct
sockaddr_in6
))
addr6
=
(
struct
sockaddr_in6
*
)
sa
;
{
addr6
=
(
struct
sockaddr_in6
*
)
sa
;
port
=
addr6
->
sin6_port
;
}
else
{
callback
(
arg
,
ARES_ENOTIMP
,
0
,
NULL
,
NULL
);
...
...
@@ -119,12 +126,7 @@ void ares_getnameinfo(ares_channel channel, const struct sockaddr *sa,
if
((
flags
&
ARES_NI_LOOKUPSERVICE
)
&&
!
(
flags
&
ARES_NI_LOOKUPHOST
))
{
char
buf
[
33
],
*
service
;
unsigned
int
port
=
0
;
if
(
salen
==
sizeof
(
struct
sockaddr_in
))
port
=
addr
->
sin_port
;
else
port
=
addr6
->
sin6_port
;
service
=
lookup_service
((
unsigned
short
)(
port
&
0xffff
),
flags
,
buf
,
sizeof
(
buf
));
callback
(
arg
,
ARES_SUCCESS
,
0
,
NULL
,
service
);
...
...
@@ -137,7 +139,6 @@ void ares_getnameinfo(ares_channel channel, const struct sockaddr *sa,
/* A numeric host can be handled without DNS */
if
((
flags
&
ARES_NI_NUMERICHOST
))
{
unsigned
int
port
=
0
;
char
ipbuf
[
IPBUFSIZ
];
char
srvbuf
[
33
];
char
*
service
=
NULL
;
...
...
@@ -154,7 +155,6 @@ void ares_getnameinfo(ares_channel channel, const struct sockaddr *sa,
if
(
salen
==
sizeof
(
struct
sockaddr_in6
))
{
ares_inet_ntop
(
AF_INET6
,
&
addr6
->
sin6_addr
,
ipbuf
,
IPBUFSIZ
);
port
=
addr6
->
sin6_port
;
/* If the system supports scope IDs, use it */
#ifdef HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID
append_scopeid
(
addr6
,
flags
,
ipbuf
,
sizeof
(
ipbuf
));
...
...
@@ -163,7 +163,6 @@ void ares_getnameinfo(ares_channel channel, const struct sockaddr *sa,
else
{
ares_inet_ntop
(
AF_INET
,
&
addr
->
sin_addr
,
ipbuf
,
IPBUFSIZ
);
port
=
addr
->
sin_port
;
}
/* They also want a service */
if
(
flags
&
ARES_NI_LOOKUPSERVICE
)
...
...
This diff is collapsed.
Click to expand it.
ares/ares_init.c
+
6
−
3
View file @
31e106ce
...
...
@@ -975,6 +975,9 @@ static int init_by_defaults(ares_channel channel)
{
char
*
hostname
=
NULL
;
int
rc
=
ARES_SUCCESS
;
#ifdef HAVE_GETHOSTNAME
char
*
dot
;
#endif
if
(
channel
->
flags
==
-
1
)
channel
->
flags
=
0
;
...
...
@@ -1044,15 +1047,15 @@ static int init_by_defaults(ares_channel channel)
}
while
(
0
);
if
(
strchr
(
hostname
,
'.'
))
{
dot
=
strchr
(
hostname
,
'.'
);
if
(
dot
)
{
/* a dot was found */
channel
->
domains
=
malloc
(
sizeof
(
char
*
));
if
(
!
channel
->
domains
)
{
rc
=
ARES_ENOMEM
;
goto
error
;
}
channel
->
domains
[
0
]
=
strdup
(
strchr
(
hostname
,
'.'
)
+
1
);
channel
->
domains
[
0
]
=
strdup
(
dot
+
1
);
if
(
!
channel
->
domains
[
0
])
{
rc
=
ARES_ENOMEM
;
goto
error
;
...
...
This diff is collapsed.
Click to expand it.
lib/url.c
+
5
−
3
View file @
31e106ce
...
...
@@ -3946,9 +3946,11 @@ static CURLcode parse_remote_port(struct SessionHandle *data,
conn
->
host
.
name
++
;
/* skip over the starting bracket */
portptr
=
strchr
(
conn
->
host
.
name
,
']'
);
*
portptr
++
=
0
;
/* zero terminate, killing the bracket */
if
(
':'
!=
*
portptr
)
portptr
=
NULL
;
/* no port number available */
if
(
portptr
)
{
*
portptr
++
=
'\0'
;
/* zero terminate, killing the bracket */
if
(
':'
!=
*
portptr
)
portptr
=
NULL
;
/* no port number available */
}
}
else
portptr
=
strrchr
(
conn
->
host
.
name
,
':'
);
...
...
This diff is collapsed.
Click to expand it.
tests/server/sws.c
+
1
−
0
View file @
31e106ce
...
...
@@ -584,6 +584,7 @@ static int get_request(curl_socket_t sock, struct httprequest *req)
/*** end of httprequest init ***/
while
(
req
->
offset
<
REQBUFSIZ
-
1
)
{
if
(
pipereq_length
&&
pipereq
)
{
if
(
pipereq_length
)
{
memmove
(
reqbuf
,
pipereq
,
pipereq_length
);
got
=
pipereq_length
;
...
...
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