svn rev #23313: trunk/src/lib/kadm5/
ghudson@MIT.EDU
ghudson at MIT.EDU
Mon Nov 23 14:24:42 EST 2009
http://src.mit.edu/fisheye/changelog/krb5/?cs=23313
Commit By: ghudson
Log Message:
Check return value of gethostname in krb5_klog_init.
Changed Files:
U trunk/src/lib/kadm5/logger.c
Modified: trunk/src/lib/kadm5/logger.c
===================================================================
--- trunk/src/lib/kadm5/logger.c 2009-11-22 21:45:06 UTC (rev 23312)
+++ trunk/src/lib/kadm5/logger.c 2009-11-23 19:24:42 UTC (rev 23313)
@@ -668,8 +668,11 @@
log_control.log_whoami = strdup(whoami);
log_control.log_hostname = (char *) malloc(MAXHOSTNAMELEN + 1);
if (log_control.log_hostname) {
- gethostname(log_control.log_hostname, MAXHOSTNAMELEN);
- log_control.log_hostname[MAXHOSTNAMELEN] = '\0';
+ if (gethostname(log_control.log_hostname, MAXHOSTNAMELEN) == -1) {
+ free(log_control.log_hostname);
+ log_control.log_hostname = NULL;
+ } else
+ log_control.log_hostname[MAXHOSTNAMELEN] = '\0';
}
#ifdef HAVE_OPENLOG
if (do_openlog) {
More information about the cvs-krb5
mailing list