From de91c1b60952a1e866b42b5dbc82eb7fe1d35d17 Mon Sep 17 00:00:00 2001 From: Alexandra Ellwood Date: Fri, 11 Jul 2003 22:12:32 +0000 Subject: [PATCH] Check for NULL realm argument and n not equal to 1. Fill in realm with an empty string on error in case the caller doesn't check the return value ticket: 1657 git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@15684 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/krb4/ChangeLog | 6 ++++++ src/lib/krb4/RealmsConfig-glue.c | 8 ++++++++ 2 files changed, 14 insertions(+) diff --git a/src/lib/krb4/ChangeLog b/src/lib/krb4/ChangeLog index 5996d991a..f8da81e90 100644 --- a/src/lib/krb4/ChangeLog +++ b/src/lib/krb4/ChangeLog @@ -1,3 +1,9 @@ +2003-07-11 Alexandra Ellwood + + * RealmsConfig-glue.c: Check for NULL realm argument and n + not equal to 1. Fill in realm with an empty string on error + in case the caller doesn't check the return value. + 2003-07-11 Alexandra Ellwood * RealmsConfig-glue.c: Don't fail when krb5.conf is valid diff --git a/src/lib/krb4/RealmsConfig-glue.c b/src/lib/krb4/RealmsConfig-glue.c index fc9bdc8f3..0635284c0 100644 --- a/src/lib/krb4/RealmsConfig-glue.c +++ b/src/lib/krb4/RealmsConfig-glue.c @@ -199,6 +199,14 @@ krb_get_lrealm( char krbConfLocalRealm[REALM_SZ]; int krbConfHasLocalRealm = 0; + if ((realm == NULL) || (n != 1)) { result = KFAILURE; } + + if (result == KSUCCESS) { + /* Some callers don't check the return value so we initialize + * to an empty string in case it never gets filled in. */ + realm [0] = '\0'; + } + if (result == KSUCCESS) { int profileErr = krb_get_profile (&profile); -- 2.26.2