From d6aad0085eeace08d63803e8f8829ef41b8d200f Mon Sep 17 00:00:00 2001
From: Tom Yu <tlyu@mit.edu>
Date: Mon, 7 Aug 2006 19:38:41 +0000
Subject: [PATCH] pull up r18404 from trunk

 r18404@cathode-dark-space:  tlyu | 2006-08-02 16:51:50 -0400
 ticket: 3904
 tags: pullup

 Apply patch from Michael Calmer to fix some uninitialized variables.

 	* src/appl/gssftp/ftpd/ftpd.c (auth_data): Initialize stat_maj,
 	accept_maj, acquire_maj.

 	* src/appl/telnet/libtelnet/kerberos5.c (kerberos5_send):
 	Intialize rdata.

 	* src/kdc/do_tgs_req.c (process_tgs_req): Initialize magic and
 	tr_contents.magic.

 	* src/lib/krb5/asn.1/krb5_decode.c (decode_krb5_safe_with_body):
 	Initialize tmpbody.magic.

 	* src/plugins/kdb/db2/libdb2/hash/dbm.c (kdb2_fetch)
 	(kdb2_firstkey, kdb2_nextkey): Initialize dsize.



ticket: 3904
version_fixed: 1.5.1

git-svn-id: svn://anonsvn.mit.edu/krb5/branches/krb5-1-5@18408 dc483132-0cff-0310-8789-dd5450dbe970
---
 src/appl/gssftp/ftpd/ftpd.c           | 4 +++-
 src/appl/telnet/libtelnet/kerberos5.c | 1 +
 src/kdc/do_tgs_req.c                  | 2 ++
 src/lib/krb5/asn.1/krb5_decode.c      | 1 +
 src/plugins/kdb/db2/libdb2/hash/dbm.c | 3 +++
 5 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/appl/gssftp/ftpd/ftpd.c b/src/appl/gssftp/ftpd/ftpd.c
index 71744a57f..9a3639b3e 100644
--- a/src/appl/gssftp/ftpd/ftpd.c
+++ b/src/appl/gssftp/ftpd/ftpd.c
@@ -2389,7 +2389,9 @@ char *adata;
 		char service_name[MAXHOSTNAMELEN+10];
 		char **gservice;
 		struct hostent *hp;
-
+		stat_maj = 0;
+		accept_maj = 0;
+		acquire_maj = 0;
 
 		kerror = radix_encode(adata, gout_buf, &length, 1);
 		if (kerror) {
diff --git a/src/appl/telnet/libtelnet/kerberos5.c b/src/appl/telnet/libtelnet/kerberos5.c
index ab8e04d3c..958a4ce4a 100644
--- a/src/appl/telnet/libtelnet/kerberos5.c
+++ b/src/appl/telnet/libtelnet/kerberos5.c
@@ -260,6 +260,7 @@ kerberos5_send(ap)
 	if (telnet_krb5_realm != NULL) {
 	    krb5_data rdata;
 
+	    rdata.magic = 0;
 	    rdata.length = strlen(telnet_krb5_realm);
 	    rdata.data = (char *) malloc(rdata.length + 1);
 	    if (rdata.data == NULL) {
diff --git a/src/kdc/do_tgs_req.c b/src/kdc/do_tgs_req.c
index fd868ff36..7b9e1b573 100644
--- a/src/kdc/do_tgs_req.c
+++ b/src/kdc/do_tgs_req.c
@@ -474,6 +474,8 @@ tgt_again:
 	    goto cleanup;
 	}
 	enc_tkt_transited.tr_type = KRB5_DOMAIN_X500_COMPRESS;
+	enc_tkt_transited.magic = 0;
+	enc_tkt_transited.tr_contents.magic = 0;
 	enc_tkt_transited.tr_contents.data = 0;
 	enc_tkt_transited.tr_contents.length = 0;
 	enc_tkt_reply.transited = enc_tkt_transited;
diff --git a/src/lib/krb5/asn.1/krb5_decode.c b/src/lib/krb5/asn.1/krb5_decode.c
index 04097b0d1..e5cd4f845 100644
--- a/src/lib/krb5/asn.1/krb5_decode.c
+++ b/src/lib/krb5/asn.1/krb5_decode.c
@@ -526,6 +526,7 @@ krb5_error_code decode_krb5_safe_with_body(
   setup();
   alloc_field(*rep,krb5_safe);
   clear_field(rep,checksum);
+  tmpbody.magic = 0;
 
   check_apptag(20);
   { begin_structure();
diff --git a/src/plugins/kdb/db2/libdb2/hash/dbm.c b/src/plugins/kdb/db2/libdb2/hash/dbm.c
index 58c9df738..43eaf444a 100644
--- a/src/plugins/kdb/db2/libdb2/hash/dbm.c
+++ b/src/plugins/kdb/db2/libdb2/hash/dbm.c
@@ -90,6 +90,7 @@ kdb2_fetch(key)
 	if (__cur_db == NULL) {
 		no_open_db();
 		item.dptr = 0;
+		item.dsize = 0;
 		return (item);
 	}
 	return (kdb2_dbm_fetch(__cur_db, key));
@@ -103,6 +104,7 @@ kdb2_firstkey()
 	if (__cur_db == NULL) {
 		no_open_db();
 		item.dptr = 0;
+		item.dsize = 0;
 		return (item);
 	}
 	return (kdb2_dbm_firstkey(__cur_db));
@@ -117,6 +119,7 @@ kdb2_nextkey(key)
 	if (__cur_db == NULL) {
 		no_open_db();
 		item.dptr = 0;
+		item.dsize = 0;
 		return (item);
 	}
 	return (kdb2_dbm_nextkey(__cur_db));
-- 
2.26.2