From: John Kohl Date: Tue, 17 Apr 1990 17:41:56 +0000 (+0000) Subject: use krb5_data * in macros, and sanity check it first X-Git-Tag: krb5-1.0-alpha2~911 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=4ba78d6917717a533469ade2b06a4196fcbc07ec;p=krb5.git use krb5_data * in macros, and sanity check it first git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@484 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/include/krb5/asn.1/encode.h b/src/include/krb5/asn.1/encode.h index 0b2602e86..044927f4c 100644 --- a/src/include/krb5/asn.1/encode.h +++ b/src/include/krb5/asn.1/encode.h @@ -225,14 +225,30 @@ krb5_error_code decode_generic */ /* allow either constructed or primitive encoding, so check for bit 6 set or reset */ -#define krb5_is_as_req(data) ((data)[0] == 0x60 || (data)[0] == 0x20) -#define krb5_is_kdc_rep(data) ((data)[0] == 0x61 || (data)[0] == 0x21) -#define krb5_is_krb_error(data) ((data)[0] == 0x62 || (data)[0] == 0x22) -#define krb5_is_ap_req(data) ((data)[0] == 0x63 || (data)[0] == 0x23) -#define krb5_is_ap_rep(data) ((data)[0] == 0x64 || (data)[0] == 0x24) -#define krb5_is_tgs_req(data) ((data)[0] == 0x65 || (data)[0] == 0x25) -#define krb5_is_krb_safe(data) ((data)[0] == 0x66 || (data)[0] == 0x26) -#define krb5_is_krb_priv(data) ((data)[0] == 0x67 || (data)[0] == 0x27) +#define krb5_is_as_req(dat)\ + ((dat) && (dat)->length && ((dat)->data[0] == 0x60 ||\ + (dat)->data[0] == 0x20)) +#define krb5_is_kdc_rep(dat)\ + ((dat) && (dat)->length && ((dat)->data[0] == 0x61 ||\ + (dat)->data[0] == 0x21)) +#define krb5_is_krb_error(dat)\ + ((dat) && (dat)->length && ((dat)->data[0] == 0x62 ||\ + (dat)->data[0] == 0x22)) +#define krb5_is_ap_req(dat)\ + ((dat) && (dat)->length && ((dat)->data[0] == 0x63 ||\ + (dat)->data[0] == 0x23)) +#define krb5_is_ap_rep(dat)\ + ((dat) && (dat)->length && ((dat)->data[0] == 0x64 ||\ + (dat)->data[0] == 0x24)) +#define krb5_is_tgs_req(dat)\ + ((dat) && (dat)->length && ((dat)->data[0] == 0x65 ||\ + (dat)->data[0] == 0x25)) +#define krb5_is_krb_safe(dat)\ + ((dat) && (dat)->length && ((dat)->data[0] == 0x66 ||\ + (dat)->data[0] == 0x26)) +#define krb5_is_krb_priv(dat)\ + ((dat) && (dat)->length && ((dat)->data[0] == 0x67 ||\ + (dat)->data[0] == 0x27)) #endif /* KRB5_ENCODE_DEFS__ */