Skip Menu |
 

Subject: Eliminate use of "unsafe" functions
Audit tools such as lint and Coverity's SECURE_CODING checker flag all
uses of functions which are often used unsafely. For Coverity, these
include strcpy, strcat, sprintf, all *scanf variants, random, lrand48,
and rand.

Although these functions are used safely within the krb5 code base to
the best of our knowledge, their use is undesirable because ensuring
their safety requires manual investigation each time the code base is
audited (by us or by others). This ticket will track the process of
eliminating these uses.
From: ghudson@mit.edu
Subject: SVN Commit
Download (untitled) / with headers
text/plain 1.9KiB

Use strdup in place of malloc/strcpy in many places.

Commit By: ghudson



Revision: 20898
Changed Files:
U trunk/src/appl/bsd/kcmd.c
U trunk/src/appl/bsd/krcp.c
U trunk/src/appl/bsd/krlogin.c
U trunk/src/appl/bsd/krsh.c
U trunk/src/appl/bsd/krshd.c
U trunk/src/appl/bsd/login.c
U trunk/src/appl/gssftp/ftp/ruserpass.c
U trunk/src/appl/gssftp/ftpd/ftpcmd.y
U trunk/src/appl/gssftp/ftpd/ftpd.c
U trunk/src/appl/telnet/libtelnet/kerberos5.c
U trunk/src/ccapi/lib/ccapi_string.c
U trunk/src/kadmin/dbutil/ovload.c
U trunk/src/kadmin/testing/util/tcl_kadm5.c
U trunk/src/kdc/do_as_req.c
U trunk/src/kdc/do_tgs_req.c
U trunk/src/lib/gssapi/generic/util_canonhost.c
U trunk/src/lib/gssapi/generic/util_localhost.c
U trunk/src/lib/gssapi/krb5/gssapi_krb5.c
U trunk/src/lib/gssapi/mechglue/g_dsp_status.c
U trunk/src/lib/gssapi/spnego/spnego_mech.c
U trunk/src/lib/kadm5/logger.c
U trunk/src/lib/kadm5/srv/server_acl.c
U trunk/src/lib/kadm5/srv/svr_policy.c
U trunk/src/lib/kadm5/srv/svr_principal.c
U trunk/src/lib/krb5/asn.1/asn1buf.c
U trunk/src/lib/krb5/ccache/cc_memory.c
U trunk/src/lib/krb5/ccache/ccapi/stdcc.c
U trunk/src/lib/krb5/keytab/kt_file.c
U trunk/src/lib/krb5/keytab/kt_memory.c
U trunk/src/lib/krb5/keytab/kt_srvtab.c
U trunk/src/lib/krb5/krb/get_in_tkt.c
U trunk/src/lib/krb5/krb/set_realm.c
U trunk/src/lib/krb5/os/ccdefname.c
U trunk/src/lib/krb5/os/def_realm.c
U trunk/src/lib/krb5/os/hst_realm.c
U trunk/src/lib/krb5/os/init_os_ctx.c
U trunk/src/lib/krb5/os/promptusr.c
U trunk/src/lib/krb5/os/realm_dom.c
U trunk/src/lib/krb5/rcache/rc_dfl.c
U trunk/src/lib/krb5/rcache/rc_io.c
U trunk/src/plugins/preauth/pkinit/pkinit_profile.c
U trunk/src/slave/kprop.c
U trunk/src/slave/kpropd.c
U trunk/src/tests/asn.1/ktest.c
U trunk/src/tests/asn.1/utility.c
U trunk/src/util/et/error_table.y
U trunk/src/util/profile/prof_get.c
U trunk/src/util/profile/prof_tree.c
U trunk/src/util/ss/help.c
U trunk/src/wconfig.c
From: ghudson@mit.edu
Subject: SVN Commit

Use asprintf instead of malloc/strcpy/strcat in many places.

Commit By: ghudson



Revision: 20901
Changed Files:
U trunk/src/appl/bsd/kcmd.c
U trunk/src/appl/bsd/krlogind.c
U trunk/src/appl/gssftp/ftp/glob.c
U trunk/src/clients/kpasswd/ksetpwd.c
U trunk/src/kadmin/cli/kadmin.c
U trunk/src/kadmin/dbutil/dump.c
U trunk/src/kadmin/dbutil/kdb5_util.c
U trunk/src/kadmin/dbutil/loadv4.c
U trunk/src/lib/kdb/kdb5.c
U trunk/src/lib/krb5/rcache/rc_io.c
U trunk/src/plugins/kdb/db2/kdb_db2.c
U trunk/src/slave/kprop.c
U trunk/src/slave/kpropd.c
U trunk/src/tests/shlib/t_loader.c
U trunk/src/util/et/error_table.y
U trunk/src/util/et/internal.h
U trunk/src/util/profile/prof_file.c
U trunk/src/util/ss/utils.c
From: ghudson@mit.edu
Subject: SVN Commit

Use snprintf instead of strcpy/strcat in many places.

Commit By: ghudson



Revision: 20912
Changed Files:
U trunk/src/appl/gssftp/ftp/cmds.c
U trunk/src/appl/gssftp/ftpd/ftpd.c
U trunk/src/appl/telnet/libtelnet/kerberos5.c
U trunk/src/appl/telnet/libtelnet/spx.c
U trunk/src/appl/telnet/telnetd/sys_term.c
U trunk/src/clients/ksu/ccache.c
U trunk/src/include/k5-platform.h
U trunk/src/kadmin/ktutil/ktutil_funcs.c
U trunk/src/lib/des425/read_passwd.c
U trunk/src/lib/kdb/kdb_default.c
U trunk/src/lib/krb5/ccache/cc_file.c
U trunk/src/lib/krb5/keytab/kt_file.c
U trunk/src/lib/krb5/keytab/kt_memory.c
U trunk/src/lib/krb5/keytab/kt_srvtab.c
U trunk/src/lib/krb5/krb/gic_pwd.c
From: ghudson@mit.edu
Subject: SVN Commit

Add build system support for strlcpy and strlcat on platforms which do
not provide it natively.

Commit By: ghudson



Revision: 20916
Changed Files:
U trunk/README
U trunk/src/configure.in
U trunk/src/include/k5-platform.h
U trunk/src/util/support/Makefile.in
A trunk/src/util/support/strlcpy.c
From: ghudson@mit.edu
Subject: SVN Commit
Download (untitled) / with headers
text/plain 1.5KiB

Use strlcpy instead of strcpy in many places.

Commit By: ghudson



Revision: 20919
Changed Files:
U trunk/src/appl/bsd/krlogin.c
U trunk/src/appl/bsd/krlogind.c
U trunk/src/appl/bsd/krshd.c
U trunk/src/appl/bsd/login.c
U trunk/src/appl/bsd/v4rcp.c
U trunk/src/appl/gssftp/ftp/cmds.c
U trunk/src/appl/gssftp/ftp/ftp.c
U trunk/src/appl/gssftp/ftp/glob.c
U trunk/src/appl/gssftp/ftpd/ftpd.c
U trunk/src/appl/libpty/getpty.c
U trunk/src/appl/libpty/update_utmp.c
U trunk/src/appl/telnet/libtelnet/kerberos5.c
U trunk/src/appl/telnet/telnet/commands.c
U trunk/src/kadmin/dbutil/dumpv4.c
U trunk/src/kadmin/server/ipropd_svc.c
U trunk/src/kadmin/server/schpw.c
U trunk/src/kdc/fakeka.c
U trunk/src/kdc/kdc_authdata.c
U trunk/src/kdc/kerberos_v4.c
U trunk/src/kdc/network.c
U trunk/src/lib/crypto/cksumtype_to_string.c
U trunk/src/lib/crypto/enctype_to_string.c
U trunk/src/lib/kadm5/clnt/Makefile.in
U trunk/src/lib/kadm5/srv/Makefile.in
U trunk/src/lib/kadm5/str_conv.c
U trunk/src/lib/kdb/kdb5.c
U trunk/src/lib/kdb/keytab.c
U trunk/src/lib/krb5/krb/conv_princ.c
U trunk/src/lib/krb5/krb/gic_pwd.c
U trunk/src/lib/krb5/krb/str_conv.c
U trunk/src/lib/krb5/os/an_to_ln.c
U trunk/src/lib/krb5/os/hst_realm.c
U trunk/src/lib/krb5/os/ktdefname.c
U trunk/src/lib/krb5/os/sendto_kdc.c
U trunk/src/plugins/kdb/db2/kdb_db2.c
U trunk/src/tests/resolve/Makefile.in
U trunk/src/tests/resolve/addrinfo-test.c
U trunk/src/util/et/error_message.c
U trunk/src/util/support/errors.c
From: ghudson@mit.edu
Subject: SVN Commit

Add the k5buf string module to libkrb5support.

Commit By: ghudson



Revision: 20929
Changed Files:
A trunk/src/include/k5-buf.h
U trunk/src/include/k5-int.h
_U trunk/src/util/support/
U trunk/src/util/support/Makefile.in
A trunk/src/util/support/k5buf-int.h
A trunk/src/util/support/k5buf.c
U trunk/src/util/support/libkrb5support-fixed.exports
A trunk/src/util/support/t_k5buf.c
From: ghudson@mit.edu
Subject: SVN Commit

Eliminate use of strcpy/strcat/sprintf in wconfig.c. Use memcpy since
we cannot rely on libkrb5support to give us the good stuff. Also fix
up (to some extent) an assumption that size_t == int.

Commit By: ghudson



Revision: 20930
Changed Files:
U trunk/src/wconfig.c
From: ghudson@mit.edu
Subject: SVN Commit

In the k5buf module, add a function to append formatted data to a
buffer.

Commit By: ghudson



Revision: 20932
Changed Files:
U trunk/src/include/k5-buf.h
U trunk/src/util/support/k5buf.c
U trunk/src/util/support/t_k5buf.c
From: ghudson@mit.edu
Subject: SVN Commit

Update the exports file for krb5int_buf_add_fmt.

Commit By: ghudson



Revision: 20933
Changed Files:
U trunk/src/util/support/libkrb5support-fixed.exports
From: ghudson@mit.edu
Subject: SVN Commit

Use the k5buf module instead of strcpy/strcat in several places.

Commit By: ghudson



Revision: 20941
Changed Files:
U trunk/src/appl/gssftp/ftpd/ftpcmd.y
U trunk/src/clients/ksu/authorization.c
U trunk/src/lib/crypto/t_hmac.c
U trunk/src/lib/gssapi/generic/gssapiP_generic.h
U trunk/src/lib/gssapi/mechglue/oid_ops.c
U trunk/src/lib/kadm5/alt_prof.c
U trunk/src/lib/kadm5/str_conv.c
U trunk/src/lib/krb5/krb/preauth.c
U trunk/src/lib/krb5/krb/srv_rcache.c
U trunk/src/lib/krb5/os/sendto_kdc.c
U trunk/src/plugins/kdb/ldap/libkdb_ldap/ldap_principal.c
From: ghudson@mit.edu
Subject: SVN Commit

Add a few safeties to the k5buf code, to make static analysis tools happier.

Commit By: ghudson



Revision: 20943
Changed Files:
U trunk/src/util/support/k5buf.c
From: ghudson@mit.edu
Subject: SVN Commit

Replace strcpy/strcat/sprintf uses in a couple of sample code files
with strncpy/strncat. Since this is sample code, we can't rely on
build system support for asprintf/strlcpy/strlcat.

Commit By: ghudson



Revision: 21000
Changed Files:
U trunk/src/appl/sample/sclient/sclient.c
U trunk/src/plugins/authdata/greet/greet_auth.c
From: ghudson@mit.edu
Subject: SVN Commit

Convert many uses of strcpy/strcat (and sometimes sprintf) to accepted
string-handling functions.

Commit By: ghudson



Revision: 21001
Changed Files:
U trunk/src/appl/bsd/krsh.c
U trunk/src/appl/bsd/krshd.c
U trunk/src/appl/gssftp/ftp/ftp.c
U trunk/src/appl/gssftp/ftp/glob.c
U trunk/src/appl/gssftp/ftpd/ftpcmd.y
U trunk/src/appl/telnet/libtelnet/gettytab.c
U trunk/src/kadmin/cli/kadmin.c
U trunk/src/kadmin/server/ipropd_svc.c
U trunk/src/kdc/kdc_util.c
U trunk/src/kdc/kerberos_v4.c
U trunk/src/lib/krb5/krb/parse.c
U trunk/src/lib/krb5/os/dnssrv.c
U trunk/src/lib/krb5/os/hst_realm.c
U trunk/src/plugins/kdb/ldap/libkdb_ldap/ldap_service_stash.c
U trunk/src/plugins/preauth/pkinit/pkinit_crypto_openssl.c
U trunk/src/tests/asn.1/ktest.c
U trunk/src/util/profile/prof_file.c
From: ghudson@mit.edu
Subject: SVN Commit

Rename krb5int_buf_cstr to krb5int_buf_data, since k5bufs can be used
for binary data as well as C string data. The buffer will always have
a null byte at krb5int_buf_len bytes regardless of whether it contains
C string data.

Commit By: ghudson



Revision: 21003
Changed Files:
U trunk/src/clients/ksu/authorization.c
U trunk/src/include/k5-buf.h
U trunk/src/lib/crypto/t_hmac.c
U trunk/src/lib/gssapi/mechglue/oid_ops.c
U trunk/src/lib/kadm5/alt_prof.c
U trunk/src/lib/kadm5/str_conv.c
U trunk/src/lib/krb5/krb/preauth.c
U trunk/src/lib/krb5/krb/srv_rcache.c
U trunk/src/lib/krb5/os/dnssrv.c
U trunk/src/lib/krb5/os/hst_realm.c
U trunk/src/lib/krb5/os/sendto_kdc.c
U trunk/src/plugins/kdb/ldap/libkdb_ldap/ldap_principal.c
U trunk/src/util/support/k5buf.c
U trunk/src/util/support/libkrb5support-fixed.exports
U trunk/src/util/support/t_k5buf.c
From: ghudson@mit.edu
Subject: SVN Commit

Fix a kadmin bug introduced in a recent set of string handling
conversions.

Commit By: ghudson



Revision: 21019
Changed Files:
U trunk/src/kadmin/cli/kadmin.c
From: ghudson@mit.edu
Subject: SVN Commit

Fix a krsh bug introduced in r21001 which could cause garbage at the
beginning of the command string.

Commit By: ghudson



Revision: 21065
Changed Files:
U trunk/src/appl/bsd/krsh.c
From: ghudson@mit.edu
Subject: SVN Commit
Download (untitled) / with headers
text/plain 3.3KiB

Convert many uses of sprintf to snprintf or asprintf.

Commit By: ghudson



Revision: 21258
Changed Files:
U trunk/src/appl/bsd/forward.c
U trunk/src/appl/bsd/kcmd.c
U trunk/src/appl/bsd/krcp.c
U trunk/src/appl/bsd/krlogin.c
U trunk/src/appl/bsd/krlogind.c
U trunk/src/appl/bsd/krshd.c
U trunk/src/appl/bsd/login.c
U trunk/src/appl/bsd/v4rcp.c
U trunk/src/appl/gss-sample/gss-client.c
U trunk/src/appl/gssftp/ftp/ftp.c
U trunk/src/appl/gssftp/ftp/ruserpass.c
U trunk/src/appl/gssftp/ftpd/ftpd.c
U trunk/src/appl/libpty/getpty.c
U trunk/src/appl/libpty/logwtmp.c
U trunk/src/appl/sample/sserver/sserver.c
U trunk/src/appl/telnet/libtelnet/auth.c
U trunk/src/appl/telnet/libtelnet/enc_des.c
U trunk/src/appl/telnet/libtelnet/encrypt.c
U trunk/src/appl/telnet/libtelnet/forward.c
U trunk/src/appl/telnet/libtelnet/kerberos.c
U trunk/src/appl/telnet/libtelnet/kerberos5.c
U trunk/src/appl/telnet/libtelnet/spx.c
U trunk/src/appl/telnet/telnet/commands.c
U trunk/src/appl/telnet/telnet/telnet.c
U trunk/src/appl/telnet/telnet/utilities.c
U trunk/src/appl/telnet/telnetd/slc.c
U trunk/src/appl/telnet/telnetd/sys_term.c
U trunk/src/clients/ksu/authorization.c
U trunk/src/clients/ksu/krb_auth_su.c
U trunk/src/clients/ksu/main.c
U trunk/src/kadmin/cli/kadmin.c
U trunk/src/kadmin/dbutil/kadm5_create.c
U trunk/src/kadmin/ktutil/ktutil_funcs.c
U trunk/src/kadmin/passwd/xm_kpasswd.c
U trunk/src/kadmin/server/ipropd_svc.c
U trunk/src/kdc/fakeka.c
U trunk/src/lib/crypto/vectors.c
U trunk/src/lib/krb5/krb/pkinit_apple_cert_store.c
U trunk/src/lib/krb5/krb/pkinit_apple_utils.c
U trunk/src/lib/krb5/krb/t_ser.c
U trunk/src/lib/krb5/os/t_gifconf.c
U trunk/src/lib/krb5/os/t_locate_kdc.c
U trunk/src/lib/rpc/unit-test/client.c
U trunk/src/lib/rpc/unit-test/server.c
U trunk/src/plugins/kdb/db2/libdb2/test/dbtest.c
U trunk/src/plugins/kdb/db2/libdb2/test/hash1.tests/driver2.c
U trunk/src/plugins/kdb/ldap/ldap_util/kdb5_ldap_policy.c
U trunk/src/plugins/kdb/ldap/ldap_util/kdb5_ldap_realm.c
U trunk/src/plugins/kdb/ldap/ldap_util/kdb5_ldap_services.c
U trunk/src/plugins/kdb/ldap/libkdb_ldap/kdb_ldap.c
U trunk/src/plugins/kdb/ldap/libkdb_ldap/ldap_create.c
U trunk/src/plugins/kdb/ldap/libkdb_ldap/ldap_misc.c
U trunk/src/plugins/kdb/ldap/libkdb_ldap/ldap_principal.c
U trunk/src/plugins/kdb/ldap/libkdb_ldap/ldap_principal2.c
U trunk/src/plugins/kdb/ldap/libkdb_ldap/ldap_realm.c
U trunk/src/plugins/kdb/ldap/libkdb_ldap/ldap_service_rights.c
U trunk/src/plugins/kdb/ldap/libkdb_ldap/ldap_service_stash.c
U trunk/src/plugins/kdb/ldap/libkdb_ldap/ldap_services.c
U trunk/src/plugins/locate/python/py-locate.c
U trunk/src/plugins/preauth/cksum_body/cksum_body_main.c
U trunk/src/plugins/preauth/pkinit/pkinit_crypto_openssl.c
U trunk/src/plugins/preauth/wpse/wpse_main.c
U trunk/src/slave/kprop.c
U trunk/src/slave/kpropd.c
U trunk/src/tests/create/kdb5_mkdums.c
U trunk/src/tests/gss-threads/gss-client.c
U trunk/src/tests/hammer/kdc5_hammer.c
U trunk/src/tests/resolve/addrinfo-test.c
U trunk/src/tests/shlib/t_loader.c
U trunk/src/tests/threads/t_rcache.c
U trunk/src/tests/verify/kdb5_verify.c
U trunk/src/util/et/t_com_err.c
U trunk/src/util/ss/utils.c
U trunk/src/util/support/fake-addrinfo.c
U trunk/src/util/support/init-addrinfo.c
From: ghudson@mit.edu
Subject: SVN Commit

In recvauth_common, convert a use of strcpy to strdup.


https://github.com/krb5/krb5/commit/dc438115063378d64441939d12c8f37cea0089ec
Commit By: ghudson
Revision: 22343
Changed Files:
U trunk/src/lib/krb5/krb/recvauth.c