[krbdev.mit.edu #9047] git commit

"Greg Hudson via RT" <[email protected]> Thu, 27 Jan 2022 21:11:01 -0500
Newsgroups gmane.comp.encryption.kerberos.bugs
Message-ID <[email protected]>
Thu Jan 27 21:11:01 2022: Request 9047 was acted upon.
 Transaction: Ticket created by [email protected]
       Queue: krb5
     Subject: git commit
       Owner: [email protected]
  Requestors: 
      Status: new
 Ticket <URL: https://krbdev.mit.edu/rt/Ticket/Display.html?id=9047 >



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.

https://github.com/krb5/krb5/commit/b6a29fec8e9f283aec0b82ca22328014725d0d7f
Author: Greg Hudson <[email protected]>
Commit: b6a29fec8e9f283aec0b82ca22328014725d0d7f
Branch: master
 src/kadmin/server/server_stubs.c |    6 +++-
 src/lib/krb5/krb/get_in_tkt.c    |    5 +--
 src/lib/krb5/krb/preauth_otp.c   |   41 +++++++++++++++++--------------------
 src/lib/krb5/os/sn2princ.c       |    2 +-
 4 files changed, 26 insertions(+), 28 deletions(-)