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)
This commit is contained in:
bz 2005-05-28 13:15:44 +00:00
parent c060f4b949
commit d98e11da23

View File

@ -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;