use memcpy and strlcpy
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@7881 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -119,7 +119,7 @@ krb5_parse_name(krb5_context context,
|
|||||||
ret = ENOMEM;
|
ret = ENOMEM;
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
strncpy(comp[n], start, q - start);
|
memcpy(comp[n], start, q - start);
|
||||||
comp[n][q - start] = 0;
|
comp[n][q - start] = 0;
|
||||||
n++;
|
n++;
|
||||||
}
|
}
|
||||||
@@ -140,7 +140,7 @@ krb5_parse_name(krb5_context context,
|
|||||||
ret = ENOMEM;
|
ret = ENOMEM;
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
strncpy(realm, start, q - start);
|
memcpy(realm, start, q - start);
|
||||||
realm[q - start] = 0;
|
realm[q - start] = 0;
|
||||||
}else{
|
}else{
|
||||||
ret = krb5_get_default_realm (context, &realm);
|
ret = krb5_get_default_realm (context, &realm);
|
||||||
@@ -152,7 +152,7 @@ krb5_parse_name(krb5_context context,
|
|||||||
ret = ENOMEM;
|
ret = ENOMEM;
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
strncpy(comp[n], start, q - start);
|
memcpy(comp[n], start, q - start);
|
||||||
comp[n][q - start] = 0;
|
comp[n][q - start] = 0;
|
||||||
n++;
|
n++;
|
||||||
}
|
}
|
||||||
@@ -838,10 +838,11 @@ krb5_524_conv_principal(krb5_context context,
|
|||||||
|
|
||||||
if(type == KRB5_NT_SRV_HST){
|
if(type == KRB5_NT_SRV_HST){
|
||||||
char *p;
|
char *p;
|
||||||
strncpy(tmpinst, i, sizeof(tmpinst));
|
|
||||||
tmpinst[sizeof(tmpinst) - 1] = 0;
|
strlcpy (tmpinst, i, sizeof(tmpinst));
|
||||||
p = strchr(tmpinst, '.');
|
p = strchr(tmpinst, '.');
|
||||||
if(p) *p = 0;
|
if(p)
|
||||||
|
*p = 0;
|
||||||
i = tmpinst;
|
i = tmpinst;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1997, 1999 Kungliga Tekniska H<>gskolan
|
* Copyright (c) 1997 - 2000 Kungliga Tekniska H<>gskolan
|
||||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
@@ -108,7 +108,7 @@ make_path(struct tr_realm *r, const char *from, const char *to)
|
|||||||
r->next = path; /* XXX */
|
r->next = path; /* XXX */
|
||||||
return ENOMEM;
|
return ENOMEM;
|
||||||
}
|
}
|
||||||
strncpy(path->realm, from, p - from);
|
memcpy(path->realm, from, p - from);
|
||||||
path->realm[p - from] = '\0';
|
path->realm[p - from] = '\0';
|
||||||
p--;
|
p--;
|
||||||
}
|
}
|
||||||
@@ -256,7 +256,7 @@ decode_realms(const char *tr, int length, struct tr_realm **realms)
|
|||||||
}
|
}
|
||||||
if(tr[i] == ','){
|
if(tr[i] == ','){
|
||||||
tmp = malloc(tr + i - start + 1);
|
tmp = malloc(tr + i - start + 1);
|
||||||
strncpy(tmp, start, tr + i - start);
|
memcpy(tmp, start, tr + i - start);
|
||||||
tmp[tr + i - start] = '\0';
|
tmp[tr + i - start] = '\0';
|
||||||
r = make_realm(tmp);
|
r = make_realm(tmp);
|
||||||
if(r == NULL){
|
if(r == NULL){
|
||||||
@@ -268,7 +268,7 @@ decode_realms(const char *tr, int length, struct tr_realm **realms)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
tmp = malloc(tr + i - start + 1);
|
tmp = malloc(tr + i - start + 1);
|
||||||
strncpy(tmp, start, tr + i - start);
|
memcpy(tmp, start, tr + i - start);
|
||||||
tmp[tr + i - start] = '\0';
|
tmp[tr + i - start] = '\0';
|
||||||
r = make_realm(tmp);
|
r = make_realm(tmp);
|
||||||
if(r == NULL){
|
if(r == NULL){
|
||||||
|
Reference in New Issue
Block a user