From 4cafbe21d0bc6bd7ca4679b237c973f545a13535 Mon Sep 17 00:00:00 2001 From: Ezra Peisach Date: Fri, 27 Oct 1995 17:40:30 +0000 Subject: [PATCH] Fix off by one in malloc for reading in name Detected only under Linux, found with purify, except when file compiled -g with suncc.... git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@7001 dc483132-0cff-0310-8789-dd5450dbe970 --- src/admin/edit/ChangeLog | 4 ++++ src/admin/edit/dump.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/admin/edit/ChangeLog b/src/admin/edit/ChangeLog index f4fd66f04..ecb4e049a 100644 --- a/src/admin/edit/ChangeLog +++ b/src/admin/edit/ChangeLog @@ -1,3 +1,7 @@ +Fri Oct 27 13:37:04 1995 Ezra Peisach + + * dump.c (process_k5_record): Fix off by one in malloc. + Mon Oct 9 16:35:19 1995 Ezra Peisach * kdb5_edit.c (extract_v4_srvtab): Extract a one byte version diff --git a/src/admin/edit/dump.c b/src/admin/edit/dump.c index c0aaa72ee..1db27e1b7 100644 --- a/src/admin/edit/dump.c +++ b/src/admin/edit/dump.c @@ -1201,7 +1201,7 @@ process_k5_record(fname, kcontext, filep, verbose, linenop) nread = fscanf(filep, "%d\t%d\t%d\t%d\t%d\t", &t1, &t2, &t3, &t4, &t5); if (nread == 5) { /* Get memory for flattened principal name */ - if (!(name = (char *) malloc((size_t) t2))) + if (!(name = (char *) malloc((size_t) t2 + 1))) error++; /* Get memory for and form tagged data linked list */ -- 2.26.2