From 52cc5043c5916b8623231b4475174307e2bfde67 Mon Sep 17 00:00:00 2001 From: John Kohl Date: Thu, 18 Oct 1990 10:36:55 +0000 Subject: [PATCH] fix concat_authorization_data to work properly in absence of authorization data (from Bill Sommerfeld) git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@1256 dc483132-0cff-0310-8789-dd5450dbe970 --- src/kdc/kdc_util.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/kdc/kdc_util.c b/src/kdc/kdc_util.c index c95680929..3fff61db6 100644 --- a/src/kdc/kdc_util.c +++ b/src/kdc/kdc_util.c @@ -40,15 +40,18 @@ krb5_authdata ***output; register krb5_authdata **ptr, **retdata; /* count up the entries */ - for (i = 0, ptr = first; *ptr; ptr++,i++); - for (ptr = second; *ptr; ptr++,i++); + i = 0; + if (first) + for (ptr = first; *ptr; ptr++,i++); + if (second) + for (ptr = second; *ptr; ptr++,i++); retdata = (krb5_authdata **)malloc((i+1)*sizeof(*retdata)); if (!retdata) return ENOMEM; retdata[i] = 0; /* null-terminated array */ for (i = 0, j = 0, ptr = first; j < 2 ; ptr = second, j++) - while (*ptr) { + while (ptr && *ptr) { /* now walk & copy */ retdata[i] = (krb5_authdata *)malloc(sizeof(*retdata[i])); if (!retdata[i]) { -- 2.26.2