Fix off-by-one error reported to NetBSD by Karl Fox in

<9411031449.AA11102@gefilte.MorningStar.Com>.
This commit is contained in:
Garrett Wollman 1994-11-03 21:04:21 +00:00
parent 84e25b852b
commit df00058df7

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* @(#)in.c 8.2 (Berkeley) 11/15/93 * @(#)in.c 8.2 (Berkeley) 11/15/93
* $Id: in.c,v 1.5 1994/09/16 05:47:06 phk Exp $ * $Id: in.c,v 1.6 1994/10/02 17:48:37 phk Exp $
*/ */
#include <sys/param.h> #include <sys/param.h>
@ -146,7 +146,7 @@ struct sockaddr_in *ap;
register char *cp = (char *) (&ap->sin_addr + 1); register char *cp = (char *) (&ap->sin_addr + 1);
ap->sin_len = 0; ap->sin_len = 0;
while (--cp > cplim) while (--cp >= cplim)
if (*cp) { if (*cp) {
(ap)->sin_len = cp - (char *) (ap) + 1; (ap)->sin_len = cp - (char *) (ap) + 1;
break; break;