Limit UDP payload size for EDNS0 to 0xffff, not use lower 16bit value.

This commit is contained in:
onoe 2002-08-28 02:37:09 +00:00
parent b888bfcc0e
commit a5fc25f65e
1 changed files with 5 additions and 3 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: res_mkquery.c,v 1.22 2002/06/26 06:00:27 itojun Exp $ */
/* $NetBSD: res_mkquery.c,v 1.23 2002/08/28 02:37:09 onoe Exp $ */
/*-
* Copyright (c) 1985, 1993
@ -59,7 +59,7 @@
static char sccsid[] = "@(#)res_mkquery.c 8.1 (Berkeley) 6/4/93";
static char rcsid[] = "Id: res_mkquery.c,v 8.5 1996/08/27 08:33:28 vixie Exp ";
#else
__RCSID("$NetBSD: res_mkquery.c,v 1.22 2002/06/26 06:00:27 itojun Exp $");
__RCSID("$NetBSD: res_mkquery.c,v 1.23 2002/08/28 02:37:09 onoe Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@ -230,7 +230,9 @@ res_opt(n0, buf, buflen, anslen)
__putshort(T_OPT, cp); /* TYPE */
cp += INT16SZ;
__putshort(anslen & 0xffff, cp); /* CLASS = UDP payload size */
if (anslen > 0xffff)
anslen = 0xffff; /* limit to 16bit value */
__putshort(anslen, cp); /* CLASS = UDP payload size */
cp += INT16SZ;
*cp++ = NOERROR; /* extended RCODE */
*cp++ = 0; /* EDNS version */