From 317227fb1b1a3899b0ea60278147435a1a4c6efd Mon Sep 17 00:00:00 2001 From: Barry Jaspan Date: Thu, 7 Nov 1996 18:10:09 +0000 Subject: [PATCH] * tcl_kadm5.c: don't assume tl_data_contents is null-terminated, and zero allocated princ before parsing it git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@9326 dc483132-0cff-0310-8789-dd5450dbe970 --- src/kadmin/testing/util/ChangeLog | 5 +++++ src/kadmin/testing/util/tcl_kadm5.c | 7 +++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/kadmin/testing/util/ChangeLog b/src/kadmin/testing/util/ChangeLog index ab44c96d9..b3c2ee1ef 100644 --- a/src/kadmin/testing/util/ChangeLog +++ b/src/kadmin/testing/util/ChangeLog @@ -1,3 +1,8 @@ +Thu Nov 7 13:09:33 1996 Barry Jaspan + + * tcl_kadm5.c: don't assume tl_data_contents is null-terminated, + and zero allocated princ before parsing it + Thu Nov 7 11:36:15 1996 Ezra Peisach * tcl_kadm5.c (parse_keysalts, parse_tl_data): Do not free memory diff --git a/src/kadmin/testing/util/tcl_kadm5.c b/src/kadmin/testing/util/tcl_kadm5.c index e3a4d9aa1..9fac7244b 100644 --- a/src/kadmin/testing/util/tcl_kadm5.c +++ b/src/kadmin/testing/util/tcl_kadm5.c @@ -483,7 +483,9 @@ static Tcl_DString *unparse_tl_data(krb5_tl_data *tl_data, int n_tl_data) Tcl_DStringAppendElement(str, buf); sprintf(buf, "%d", tl_data->tl_data_length); Tcl_DStringAppendElement(str, buf); - Tcl_DStringAppendElement(str, tl_data->tl_data_contents); + Tcl_DStringAppend(str, " ", 1); + Tcl_DStringAppend(str, tl_data->tl_data_contents, + tl_data->tl_data_length); Tcl_DStringEndSublist(str); } Tcl_DStringEndSublist(str); @@ -1130,7 +1132,8 @@ static int parse_principal_ent(Tcl_Interp *interp, char *list, fprintf(stderr, "Out of memory!\n"); exit(1); /* XXX */ } - + memset(princ, 0, sizeof(*princ)); + if ((krb5_ret = krb5_parse_name(context, argv[0], &princ->principal)) != 0) { stash_error(interp, krb5_ret); Tcl_AppendElement(interp, "while parsing principal"); -- 2.26.2