From: Theodore Tso Date: Thu, 20 Aug 1992 01:27:29 +0000 (+0000) Subject: Changed so that the krb5_data structures (in the principal structure) X-Git-Tag: krb5-1.0-beta2~129 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=c626c7db62289b5ac143a7acc6b20c6b63c38d1b;p=krb5.git Changed so that the krb5_data structures (in the principal structure) have nulls at the end of the strings, just in case poeple are depending on it. They shouldn't, since principals component may have embedded NULL's in them, even though they usually don't. Nevertheless, it's good to be careful. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@2333 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/lib/krb5/ccache/stdio/scc_read.c b/src/lib/krb5/ccache/stdio/scc_read.c index 7fe111845..b4ebffea9 100644 --- a/src/lib/krb5/ccache/stdio/scc_read.c +++ b/src/lib/krb5/ccache/stdio/scc_read.c @@ -225,7 +225,7 @@ krb5_scc_read_data(id, data) kret = krb5_scc_read_int32(id, &data->length); CHECK(kret); - data->data = (char *) malloc(data->length); + data->data = (char *) malloc(data->length+1); if (data->data == NULL) return KRB5_CC_NOMEM; @@ -240,11 +240,8 @@ krb5_scc_read_data(id, data) xfree(data->data); return KRB5_CC_END; } + data->data[data->length] = 0; /* Null terminate just in case.... */ return KRB5_OK; - errout: - if (data->data) - xfree(data->data); - return kret; } krb5_error_code