* krb5.hin (krb5_princ_component): Return NULL if going off the end of the array
authorKen Raeburn <raeburn@mit.edu>
Thu, 20 Feb 2003 00:04:06 +0000 (00:04 +0000)
committerKen Raeburn <raeburn@mit.edu>
Thu, 20 Feb 2003 00:04:06 +0000 (00:04 +0000)
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@15193 dc483132-0cff-0310-8789-dd5450dbe970

src/include/ChangeLog
src/include/krb5.hin

index 319f5d8181cfd00958dbf539af95df21bebe7c45..d2b5e653891e7fb8f42917b4c8251bb88a3f446e 100644 (file)
@@ -1,5 +1,8 @@
 2003-02-19  Ken Raeburn  <raeburn@mit.edu>
 
+       * 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  <tlyu@mit.edu>
index a71f86b22382975c29fd011af3842b6ad8711ea4..e53606c20a7c9cb282284a6046218b934758b46d 100644 (file)
@@ -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"