From d579ee0dc907eaf1e245b2df6337903937065fb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Love=20H=C3=B6rnquist=20=C3=85strand?= Date: Sun, 2 Apr 2006 01:28:42 +0000 Subject: [PATCH] (_krb5_krbhost_info_move): replace a strcpy with a memcpy git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@16943 ec53bebd-3082-4978-b11e-865c3cabbd6b --- lib/krb5/krbhst.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/krb5/krbhst.c b/lib/krb5/krbhst.c index 6ae989d6d..2ba7239b4 100644 --- a/lib/krb5/krbhst.c +++ b/lib/krb5/krbhst.c @@ -241,8 +241,9 @@ _krb5_krbhost_info_move(krb5_context context, krb5_krbhst_info *from, krb5_krbhst_info **to) { + size_t hostnamelen = strlen(from->hostname); /* trailing NUL is included in structure */ - *to = calloc(1, sizeof(**to) + strlen(from->hostname)); + *to = calloc(1, sizeof(**to) + hostnamelen); if(*to == NULL) { krb5_set_error_string(context, "malloc - out of memory"); return ENOMEM; @@ -254,7 +255,7 @@ _krb5_krbhost_info_move(krb5_context context, (*to)->ai = from->ai; from->ai = NULL; (*to)->next = NULL; - strcpy((*to)->hostname, from->hostname); + memmcpy((*to)->hostname, from->hostname, hostnamelen + 1); return 0; }