]> git.ipfire.org Git - thirdparty/krb5.git/commit
Avoid passing null for asprintf strings 1235/head
authorGreg Hudson <ghudson@mit.edu>
Fri, 21 Jan 2022 15:58:46 +0000 (10:58 -0500)
committerGreg Hudson <ghudson@mit.edu>
Thu, 27 Jan 2022 22:26:26 +0000 (17:26 -0500)
commitb6a29fec8e9f283aec0b82ca22328014725d0d7f
treece4d7d0e73c70c0c6630d2fde3a75d20f41c4911
parentd4359c66c78a2c59e6bf3b905c4de58e920c7349
Avoid passing null for asprintf strings

It is undefined behavior to pass null to a printf function for a %.*s
substitution, even if the accompanying length is zero.  OpenBSD
generates syslog warnings from libc when it sees a null pointer in a
string substitution (reported by Nathanael Rensen).
krb5_sname_to_principal() passes a null pointer in the usual case
where there is no port trailer.  Address this case and others where we
use asprintf() with %.*s substitutions and might pass null, either by
avoiding the use of asprintf() or by ensuring that the pointer isn't
null.

ticket: 9047 (new)
src/kadmin/server/server_stubs.c
src/lib/krb5/krb/get_in_tkt.c
src/lib/krb5/krb/preauth_otp.c
src/lib/krb5/os/sn2princ.c