v3_addr.c (306195) | v3_addr.c (325337) |
---|---|
1/* 2 * Contributed to the OpenSSL Project by the American Registry for 3 * Internet Numbers ("ARIN"). 4 */ 5/* ==================================================================== 6 * Copyright (c) 2006 The OpenSSL Project. All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 116 unchanged lines hidden (view full) --- 125 } 126} 127 128/* 129 * Extract the AFI from an IPAddressFamily. 130 */ 131unsigned int v3_addr_get_afi(const IPAddressFamily *f) 132{ | 1/* 2 * Contributed to the OpenSSL Project by the American Registry for 3 * Internet Numbers ("ARIN"). 4 */ 5/* ==================================================================== 6 * Copyright (c) 2006 The OpenSSL Project. All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 116 unchanged lines hidden (view full) --- 125 } 126} 127 128/* 129 * Extract the AFI from an IPAddressFamily. 130 */ 131unsigned int v3_addr_get_afi(const IPAddressFamily *f) 132{ |
133 return ((f != NULL && 134 f->addressFamily != NULL && f->addressFamily->data != NULL) 135 ? ((f->addressFamily->data[0] << 8) | (f->addressFamily->data[1])) 136 : 0); | 133 if (f == NULL 134 || f->addressFamily == NULL 135 || f->addressFamily->data == NULL 136 || f->addressFamily->length < 2) 137 return 0; 138 return (f->addressFamily->data[0] << 8) | f->addressFamily->data[1]; |
137} 138 139/* 140 * Expand the bitstring form of an address into a raw byte array. 141 * At the moment this is coded for simplicity, not speed. 142 */ 143static int addr_expand(unsigned char *addr, 144 const ASN1_BIT_STRING *bs, --- 1206 unchanged lines hidden --- | 139} 140 141/* 142 * Expand the bitstring form of an address into a raw byte array. 143 * At the moment this is coded for simplicity, not speed. 144 */ 145static int addr_expand(unsigned char *addr, 146 const ASN1_BIT_STRING *bs, --- 1206 unchanged lines hidden --- |