summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbz <bz@FreeBSD.org>2005-05-28 13:15:44 +0000
committerbz <bz@FreeBSD.org>2005-05-28 13:15:44 +0000
commitd98e11da23d18e7f298839667a57e06356850e3c (patch)
treed2777e4a0c42e59678fb9dce7a9b3ba4ee8e3d6e
parentc060f4b949c32ac167c0d7d2fcdd89856af90aca (diff)
downloadFreeBSD-src-d98e11da23d18e7f298839667a57e06356850e3c.zip
FreeBSD-src-d98e11da23d18e7f298839667a57e06356850e3c.tar.gz
Fix use of uninitialized variable len in ngd_send.
Note: len gets intialized to 0 for sap == NULL case only to make compiler on amd64 happy. This has nothing todo with the former uninitialized use of len in sap != NULL case. Reviewed by: glebius Approved by: pjd (mentor)
-rw-r--r--sys/netgraph/ng_socket.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/sys/netgraph/ng_socket.c b/sys/netgraph/ng_socket.c
index 2fe6b31..c016955 100644
--- a/sys/netgraph/ng_socket.c
+++ b/sys/netgraph/ng_socket.c
@@ -417,13 +417,17 @@ ngd_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *addr,
error = ENOTCONN;
goto release;
}
+
+ if (sap == NULL)
+ len = 0; /* Make compiler happy. */
+ else
+ len = sap->sg_len - 2;
+
/*
* If the user used any of these ways to not specify an address
* then handle specially.
*/
- if ((sap == NULL)
- || ((len = sap->sg_len - 2) <= 0)
- || (*sap->sg_data == '\0')) {
+ if ((sap == NULL) || (len <= 0) || (*sap->sg_data == '\0')) {
if (NG_NODE_NUMHOOKS(pcbp->sockdata->node) != 1) {
error = EDESTADDRREQ;
goto release;
OpenPOWER on IntegriCloud