FreeBSD/contrib/ntp/ntpd/ntp_crypto.c
/*
 * Get the  payload size (internal value length) of an extension packet.
 * If the inner value size does not match the outer packet size (that
 * is, the value would end behind the frame given by the opcode/size
 * field) the function will effectively return UINT_MAX. If the frame is
 * too short to hold a variable-sized value, the return value is zero.
 */
Get the  payload size (internal value length) of an extension packet.
If the inner value size does not match the outer packet size (that
is, the value would end behind the frame given by the opcode/size
field) the function will effectively return UINT_MAX. If the frame is
too short to hold a variable-sized value, the return value is zero.
Get the payload size ( internal value length ) of an extension packet . If the inner value size does not match the outer packet size ( that is the value would end behind the frame given by the opcode / size field ) the function will effectively return UINT_MAX . If the frame is too short to hold a variable - sized value the return value is zero .
static u_int
exten_payload_size(
	const struct exten * ep)
{
	typedef const u_char *BPTR;
	size_t extn_size;
	size_t data_size;
	size_t head_size;
	data_size = 0;
	if (NULL != ep) {
		head_size = (BPTR)(&ep->vallen + 1) - (BPTR)ep;
		extn_size = (uint16_t)(ntohl(ep->opcode) & 0x0000ffff);
		if (extn_size >= head_size) {
			data_size = (uint32_t)ntohl(ep->vallen);
			if (data_size > extn_size - head_size)
				data_size = ~(size_t)0u;
		}
	}
	return (u_int)data_size;
}
static u_int exten_payload_size ( const struct exten * ep ) { typedef const u_char * BPTR ; size_t extn_size ; size_t data_size ; size_t head_size ; data_size = 0 ; if ( NULL != ep ) { head_size = ( BPTR ) ( & ep -> vallen + 1 ) - ( BPTR ) ep ; extn_size = ( uint16_t ) ( ntohl ( ep -> opcode ) & 0x0000ffff ) ; if ( extn_size >= head_size ) { data_size = ( uint32_t ) ntohl ( ep -> vallen ) ; if ( data_size > extn_size - head_size ) data_size = ~ ( size_t ) 0u ; } } return ( u_int ) data_size ; }
Get the  payload size (internal value length) of an extension packet.
Get the payload size ( internal value length ) of an extension packet .