You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@trafficserver.apache.org by "maskit (via GitHub)" <gi...@apache.org> on 2023/08/16 20:57:29 UTC
[GitHub] [trafficserver] maskit opened a new pull request, #10212: Coverity 1518060: Uninitialized scalar variable
maskit opened a new pull request, #10212:
URL: https://github.com/apache/trafficserver/pull/10212
This closes https://github.com/apache/trafficserver/issues/10196.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [trafficserver] maskit merged pull request #10212: Coverity 1518060: Uninitialized scalar variable
Posted by "maskit (via GitHub)" <gi...@apache.org>.
maskit merged PR #10212:
URL: https://github.com/apache/trafficserver/pull/10212
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [trafficserver] maskit commented on a diff in pull request #10212: Coverity 1518060: Uninitialized scalar variable
Posted by "maskit (via GitHub)" <gi...@apache.org>.
maskit commented on code in PR #10212:
URL: https://github.com/apache/trafficserver/pull/10212#discussion_r1298627277
##########
iocore/net/UnixUDPNet.cc:
##########
@@ -1014,8 +1014,8 @@ bool
UDPNetProcessor::CreateUDPSocket(int *resfd, sockaddr const *remote_addr, Action **status, NetVCOptions const &opt)
{
int res = 0, fd = -1;
- int local_addr_len;
IpEndpoint local_addr;
+ int local_addr_len = sizeof(local_addr.sa);
Review Comment:
I thought so too, but actually initializing it with 0 is wrong.
> getsockname() returns the current address to which the socket
sockfd is bound, in the buffer pointed to by addr. The addrlen
argument should be initialized to indicate the amount of space
(in bytes) pointed to by addr. On return it contains the actual
size of the socket address.
https://man7.org/linux/man-pages/man2/getsockname.2.html
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [trafficserver] bneradt commented on a diff in pull request #10212: Coverity 1518060: Uninitialized scalar variable
Posted by "bneradt (via GitHub)" <gi...@apache.org>.
bneradt commented on code in PR #10212:
URL: https://github.com/apache/trafficserver/pull/10212#discussion_r1297936773
##########
iocore/net/UnixUDPNet.cc:
##########
@@ -1014,8 +1014,8 @@ bool
UDPNetProcessor::CreateUDPSocket(int *resfd, sockaddr const *remote_addr, Action **status, NetVCOptions const &opt)
{
int res = 0, fd = -1;
- int local_addr_len;
IpEndpoint local_addr;
+ int local_addr_len = sizeof(local_addr.sa);
Review Comment:
Am I reading this right that this is only used as a throw-away, non-read output variable below? If so, I suggest just declaring and initializing it to zero just before the point of use.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [trafficserver] bneradt commented on a diff in pull request #10212: Coverity 1518060: Uninitialized scalar variable
Posted by "bneradt (via GitHub)" <gi...@apache.org>.
bneradt commented on code in PR #10212:
URL: https://github.com/apache/trafficserver/pull/10212#discussion_r1300711972
##########
iocore/net/UnixUDPNet.cc:
##########
@@ -1014,8 +1014,8 @@ bool
UDPNetProcessor::CreateUDPSocket(int *resfd, sockaddr const *remote_addr, Action **status, NetVCOptions const &opt)
{
int res = 0, fd = -1;
- int local_addr_len;
IpEndpoint local_addr;
+ int local_addr_len = sizeof(local_addr.sa);
Review Comment:
Ah, good to know. Thanks.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org