(_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
This commit is contained in:
@@ -241,8 +241,9 @@ _krb5_krbhost_info_move(krb5_context context,
|
|||||||
krb5_krbhst_info *from,
|
krb5_krbhst_info *from,
|
||||||
krb5_krbhst_info **to)
|
krb5_krbhst_info **to)
|
||||||
{
|
{
|
||||||
|
size_t hostnamelen = strlen(from->hostname);
|
||||||
/* trailing NUL is included in structure */
|
/* trailing NUL is included in structure */
|
||||||
*to = calloc(1, sizeof(**to) + strlen(from->hostname));
|
*to = calloc(1, sizeof(**to) + hostnamelen);
|
||||||
if(*to == NULL) {
|
if(*to == NULL) {
|
||||||
krb5_set_error_string(context, "malloc - out of memory");
|
krb5_set_error_string(context, "malloc - out of memory");
|
||||||
return ENOMEM;
|
return ENOMEM;
|
||||||
@@ -254,7 +255,7 @@ _krb5_krbhost_info_move(krb5_context context,
|
|||||||
(*to)->ai = from->ai;
|
(*to)->ai = from->ai;
|
||||||
from->ai = NULL;
|
from->ai = NULL;
|
||||||
(*to)->next = NULL;
|
(*to)->next = NULL;
|
||||||
strcpy((*to)->hostname, from->hostname);
|
memmcpy((*to)->hostname, from->hostname, hostnamelen + 1);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user