From a542b2f79de11422fc551db6128f211e63266dfa Mon Sep 17 00:00:00 2001 From: Ken Raeburn Date: Thu, 20 Feb 2003 00:04:06 +0000 Subject: [PATCH] * krb5.hin (krb5_princ_component): Return NULL if going off the end of the array git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@15193 dc483132-0cff-0310-8789-dd5450dbe970 --- src/include/ChangeLog | 3 +++ src/include/krb5.hin | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/include/ChangeLog b/src/include/ChangeLog index 319f5d818..d2b5e6538 100644 --- a/src/include/ChangeLog +++ b/src/include/ChangeLog @@ -1,5 +1,8 @@ 2003-02-19 Ken Raeburn + * krb5.hin (krb5_princ_component): Return NULL if going off the + end of the array. + * configure.in: Check for sys/select.h and time.h. 2003-02-07 Tom Yu diff --git a/src/include/krb5.hin b/src/include/krb5.hin index a71f86b22..e53606c20 100644 --- a/src/include/krb5.hin +++ b/src/include/krb5.hin @@ -267,7 +267,10 @@ typedef const krb5_principal_data *krb5_const_principal; #define krb5_princ_size(context, princ) (princ)->length #define krb5_princ_type(context, princ) (princ)->type #define krb5_princ_name(context, princ) (princ)->data -#define krb5_princ_component(context, princ,i) ((princ)->data + i) +#define krb5_princ_component(context, princ,i) \ + (((i) < krb5_princ_size(context, princ)) \ + ? (princ)->data + (i) \ + : NULL) /* * end "base-defs.h" -- 2.26.2