diff options
author | Greg Hudson <ghudson@mit.edu> | 2008-10-24 20:07:00 +0000 |
---|---|---|
committer | Greg Hudson <ghudson@mit.edu> | 2008-10-24 20:07:00 +0000 |
commit | fcf15c482b582c4f2e5dd7c6222c4e3509bbb7d6 (patch) | |
tree | 9ce89cc387b4bee641f0f25e818371b90731fdb6 /src/lib/kdb | |
parent | 4d901a092a69a69be251131174166fc661d13633 (diff) | |
download | krb5-fcf15c482b582c4f2e5dd7c6222c4e3509bbb7d6.tar.gz krb5-fcf15c482b582c4f2e5dd7c6222c4e3509bbb7d6.tar.xz krb5-fcf15c482b582c4f2e5dd7c6222c4e3509bbb7d6.zip |
Use strlcpy instead of strcpy in many places
ticket: 6200
status: open
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20919 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/lib/kdb')
-rw-r--r-- | src/lib/kdb/kdb5.c | 4 | ||||
-rw-r--r-- | src/lib/kdb/keytab.c | 3 |
2 files changed, 3 insertions, 4 deletions
diff --git a/src/lib/kdb/kdb5.c b/src/lib/kdb/kdb5.c index eb68f22fd..9c18e5dd8 100644 --- a/src/lib/kdb/kdb5.c +++ b/src/lib/kdb/kdb5.c @@ -251,7 +251,7 @@ kdb_load_library(krb5_context kcontext, char *lib_name, db_library * lib) goto clean_n_exit; } - strcpy((*lib)->name, lib_name); + strlcpy((*lib)->name, lib_name, sizeof((*lib)->name)); #if !defined(KDB5_USE_LIB_KDB_DB2) && !defined(KDB5_USE_LIB_TEST) #error No database module defined @@ -341,7 +341,7 @@ kdb_load_library(krb5_context kcontext, char *lib_name, db_library * lib) goto clean_n_exit; } - strcpy((*lib)->name, lib_name); + strlcpy((*lib)->name, lib_name, sizeof((*lib)->name)); /* Fetch the list of directories specified in the config file(s) first. */ diff --git a/src/lib/kdb/keytab.c b/src/lib/kdb/keytab.c index 227a42e08..fa95e4851 100644 --- a/src/lib/kdb/keytab.c +++ b/src/lib/kdb/keytab.c @@ -41,9 +41,8 @@ static krb5_error_code krb5_ktkdb_get_name(krb5_context context, krb5_keytab keytab, char *name, unsigned int namelen) { - if (namelen < sizeof("KDB:")) + if (strlcpy(name, "KDB:", namelen) >= namelen); return KRB5_KT_NAME_TOOLONG; - strcpy(name, "KDB:"); return 0; } |