Fix initialization and pointer bugs in new code
authorGreg Hudson <ghudson@mit.edu>
Tue, 4 Oct 2011 22:40:10 +0000 (22:40 +0000)
committerGreg Hudson <ghudson@mit.edu>
Tue, 4 Oct 2011 22:40:10 +0000 (22:40 +0000)
Coverity found some minor-to-medium bugs in some recent changes; fix
them.

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@25299 dc483132-0cff-0310-8789-dd5450dbe970

src/kdc/do_as_req.c
src/lib/apputils/net-server.c

index 7abbfac147862c34231b515ba8772a4c6110503e..9102e26a060a62ec4bc2735554abd227ac36596a 100644 (file)
@@ -131,7 +131,7 @@ finish_process_as_req(struct as_req_state *state, krb5_error_code errcode)
     krb5_key_data *server_key;
     krb5_key_data *client_key;
     krb5_keyblock *as_encrypting_key = NULL;
-    krb5_data *response;
+    krb5_data *response = NULL;
     const char *emsg = 0;
     int did_log = 0;
     register int i;
@@ -468,6 +468,7 @@ process_as_req(krb5_kdc_req *request, krb5_data *req_pkt,
     state->request = request;
     state->e_data = NULL;
     state->authtime = 0;
+    state->c_flags = 0;
     state->req_pkt = req_pkt;
     state->rstate = NULL;
     state->sname = 0;
index b31c6bc5c59b6dbcd01d97313e2893789bb3f670..11a7c122fffa3bf03168c76c036be5c154b91841 100644 (file)
@@ -1548,7 +1548,7 @@ process_packet_response(void *arg, krb5_error_code code, krb5_data *response)
     if (code)
         com_err(state->prog ? state->prog : NULL, code,
                 _("while dispatching (udp)"));
-    if (code || response == NULL || state == NULL)
+    if (code || response == NULL)
         goto out;
 
     cc = send_to_from(state->port_fd, response->data,
@@ -1900,8 +1900,10 @@ process_tcp_connection_read(verto_ctx *ctx, verto_ev *ev)
                 }
 
                 state = prepare_for_dispatch(ctx, ev);
-                if (!state)
+                if (!state) {
+                    krb5_free_data(get_context(conn->handle), response);
                     goto kill_tcp_connection;
+                }
                 process_tcp_response(state, 0, response);
             }
         }