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:
Bjoern A. Zeeb 2005-05-28 13:15:44 +00:00
parent 958a52b82b
commit 7cceedd6b5
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=146718

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;