From: Peter Howkins Date: Wed, 18 Apr 2018 00:28:03 +0000 (+0100) Subject: libtt: Coverity fixes related to uninitialised fields in classes. X-Git-Tag: 2.2.4a~75 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=02d43dabe6424ccdf740a40ee6e604458967e57f;p=oweals%2Fcde.git libtt: Coverity fixes related to uninitialised fields in classes. --- diff --git a/cde/lib/tt/bin/shell/copier.C b/cde/lib/tt/bin/shell/copier.C index e7eb27cf..aaff3579 100644 --- a/cde/lib/tt/bin/shell/copier.C +++ b/cde/lib/tt/bin/shell/copier.C @@ -75,6 +75,7 @@ copier( char *arg0 ) _preserve = FALSE; _clonedir_mode = FALSE; _tt_opened = FALSE; + _to_path_is_dir = 0; } copier:: diff --git a/cde/lib/tt/bin/shell/mover.C b/cde/lib/tt/bin/shell/mover.C index 79e9cdd3..dc659a89 100644 --- a/cde/lib/tt/bin/shell/mover.C +++ b/cde/lib/tt/bin/shell/mover.C @@ -83,6 +83,7 @@ mover( char *arg0 ) _should_mv = TRUE; _force = FALSE; _tt_opened = FALSE; + _to_path_is_dir = FALSE; } mover:: diff --git a/cde/lib/tt/bin/ttdbserverd/db_server_functions.C b/cde/lib/tt/bin/ttdbserverd/db_server_functions.C index 2264eb6e..46c67f88 100644 --- a/cde/lib/tt/bin/ttdbserverd/db_server_functions.C +++ b/cde/lib/tt/bin/ttdbserverd/db_server_functions.C @@ -1857,7 +1857,7 @@ printf("DEBUG: SERVER: _tt_file_netfile_1: _tt_file_netfile(%s) returned %s\n", if (_tt_pointer_error(canonical_path) != TT_OK) { results.results = TT_DB_ERR_ILLEGAL_FILE; - results.result_string = '\0'; + results.result_string = NULL; } else { results.results = TT_DB_OK; results.result_string = canonical_path; @@ -1897,7 +1897,7 @@ printf("DEBUG: SERVER: _tt_netfile_file_1: _tt_netfile_file(%s) returned %s\n", if (_tt_pointer_error(canonical_path) != TT_OK) { results.results = TT_DB_ERR_ILLEGAL_FILE; - results.result_string = '\0'; + results.result_string = NULL; } else { results.results = TT_DB_OK; results.result_string = canonical_path; diff --git a/cde/lib/tt/bin/ttdbserverd/dm_access_cache.h b/cde/lib/tt/bin/ttdbserverd/dm_access_cache.h index 2a8e435a..f001bef5 100644 --- a/cde/lib/tt/bin/ttdbserverd/dm_access_cache.h +++ b/cde/lib/tt/bin/ttdbserverd/dm_access_cache.h @@ -56,7 +56,7 @@ class _Tt_oid_access : public _Tt_object { public: - _Tt_oid_access() {} + _Tt_oid_access() { _user = 0; _group = 0; _mode = 0; } _Tt_oid_access(const char *key, uid_t user, gid_t group, mode_t mode); _Tt_oid_access(char *ku); ~_Tt_oid_access(); @@ -126,7 +126,7 @@ declare_ptr_to(_Tt_oid_access_queue) class _Tt_link_access : public _Tt_object { public: - _Tt_link_access() {} + _Tt_link_access() { _user = 0; _group = 0; _mode = 0; } _Tt_link_access(const char *key, uid_t user, gid_t group, mode_t mode); _Tt_link_access(char *ku); ~_Tt_link_access(); diff --git a/cde/lib/tt/bin/ttdbserverd/tt_db_message_info.h b/cde/lib/tt/bin/ttdbserverd/tt_db_message_info.h index 9cc5aed5..91f90a7c 100644 --- a/cde/lib/tt/bin/ttdbserverd/tt_db_message_info.h +++ b/cde/lib/tt/bin/ttdbserverd/tt_db_message_info.h @@ -44,7 +44,7 @@ class _Tt_db_message_info : public _Tt_object { public: - _Tt_db_message_info () {} + _Tt_db_message_info () { messageID = 0; numParts = 0; messageSize = 0; } ~_Tt_db_message_info () {} int messageID; diff --git a/cde/lib/tt/bin/ttdbserverd/tt_isam_file.C b/cde/lib/tt/bin/ttdbserverd/tt_isam_file.C index 980ca6b3..fde49aa1 100644 --- a/cde/lib/tt/bin/ttdbserverd/tt_isam_file.C +++ b/cde/lib/tt/bin/ttdbserverd/tt_isam_file.C @@ -52,6 +52,9 @@ _Tt_isam_file::_Tt_isam_file (const _Tt_string &file, int mode) else { getStatusInfo(); } + + maxRecordLength = 0; + minRecordLength = 0; } _Tt_isam_file @@ -82,7 +85,7 @@ _Tt_isam_file currentRecordLength = -1; currentRecordNumber = -1; } - + maxRecordLength = 0; minRecordLength = 0; } diff --git a/cde/lib/tt/bin/ttdbserverd/tt_isam_file.h b/cde/lib/tt/bin/ttdbserverd/tt_isam_file.h index 4e9c16ea..d064e1bc 100644 --- a/cde/lib/tt/bin/ttdbserverd/tt_isam_file.h +++ b/cde/lib/tt/bin/ttdbserverd/tt_isam_file.h @@ -45,7 +45,8 @@ typedef int (*FatalErrorHandlerFunction) (char *); class _Tt_isam_file : public _Tt_object { public: // Dummy constructor needed to make _tt_isam_file_utils.cc happy - _Tt_isam_file () {} + _Tt_isam_file () { currentRecordLength = 0; currentRecordNumber = 0; eraseFlag = 0; errorStatus = 0; + fileDescriptor = 0; fileMode = 0; maxRecordLength = 0; minRecordLength = 0; newFlag = 0; } // Real constructors _Tt_isam_file (const _Tt_string &file, int mode); diff --git a/cde/lib/tt/bin/ttdbserverd/tt_isam_key_descriptor.C b/cde/lib/tt/bin/ttdbserverd/tt_isam_key_descriptor.C index bb53600a..f30119ac 100644 --- a/cde/lib/tt/bin/ttdbserverd/tt_isam_key_descriptor.C +++ b/cde/lib/tt/bin/ttdbserverd/tt_isam_key_descriptor.C @@ -40,6 +40,12 @@ _Tt_isam_key_descriptor::_Tt_isam_key_descriptor () { keyDescriptor.k_flags = 0; keyDescriptor.k_nparts = 0; + + for(int i = 0; i < NPARTS; i++) { + keyDescriptor.k_part[i].kp_start = -1; + keyDescriptor.k_part[i].kp_leng = -1; + keyDescriptor.k_part[i].kp_type = -1; + } } _Tt_isam_key_descriptor::~_Tt_isam_key_descriptor () diff --git a/cde/lib/tt/bin/ttdbserverd/tt_isam_record.h b/cde/lib/tt/bin/ttdbserverd/tt_isam_record.h index d0d69bb4..5fea9d59 100644 --- a/cde/lib/tt/bin/ttdbserverd/tt_isam_record.h +++ b/cde/lib/tt/bin/ttdbserverd/tt_isam_record.h @@ -43,7 +43,7 @@ class _Tt_isam_record : public _Tt_object { public: // Dummy constructor needed to make tt_isam_record_utils.cc happy - _Tt_isam_record () {} + _Tt_isam_record () { currentLength = 0; maxLength = 0; minLength = 0; } // Real constructor _Tt_isam_record (const _Tt_isam_key_descriptor_list_ptr &key_descriptor_list, diff --git a/cde/lib/tt/bin/tttrace/tttrace_objs.C b/cde/lib/tt/bin/tttrace/tttrace_objs.C index 526ab725..4c2a8564 100644 --- a/cde/lib/tt/bin/tttrace/tttrace_objs.C +++ b/cde/lib/tt/bin/tttrace/tttrace_objs.C @@ -53,6 +53,9 @@ _Tt_trace_optobj::_Tt_trace_optobj() _has_session = 2; // 1 -> -S option, 2 -> set by default _has_command = 0; _form = NO_FORM; + for(int i = 0; i < MAXARGS; i++) { + _cargv[i] = NULL; + } } int diff --git a/cde/lib/tt/lib/api/c/api_storage.h b/cde/lib/tt/lib/api/c/api_storage.h index 88e222d2..1718127f 100644 --- a/cde/lib/tt/lib/api/c/api_storage.h +++ b/cde/lib/tt/lib/api/c/api_storage.h @@ -45,7 +45,7 @@ declare_ptr_to(_Tt_api_stg_stack) class _Tt_api_stg_stack_elm : public _Tt_object { public: - _Tt_api_stg_stack_elm() {}; + _Tt_api_stg_stack_elm() { addr = NULL; }; ~_Tt_api_stg_stack_elm(); enum {STACK_MARK, STACK_STORAGE} entry_type; caddr_t addr; diff --git a/cde/lib/tt/lib/api/c/api_typecb.C b/cde/lib/tt/lib/api/c/api_typecb.C index d9a05310..441b68bf 100644 --- a/cde/lib/tt/lib/api/c/api_typecb.C +++ b/cde/lib/tt/lib/api/c/api_typecb.C @@ -44,6 +44,7 @@ _Tt_typecb:: _Tt_typecb() { clientdata = 0; + _opnum = 0; } _Tt_typecb:: diff --git a/cde/lib/tt/lib/db/tt_client_isam_file.C b/cde/lib/tt/lib/db/tt_client_isam_file.C index 156b1026..c11fab73 100644 --- a/cde/lib/tt/lib/db/tt_client_isam_file.C +++ b/cde/lib/tt/lib/db/tt_client_isam_file.C @@ -89,6 +89,8 @@ _Tt_client_isam_file currentRecordLength = -1; currentRecordNumber = -1; } + maxRecordLength = 0; + minRecordLength = 0; } void _Tt_client_isam_file::setTtISAMFileDefaults () diff --git a/cde/lib/tt/lib/db/tt_client_isam_file.h b/cde/lib/tt/lib/db/tt_client_isam_file.h index f3bece3e..04273287 100644 --- a/cde/lib/tt/lib/db/tt_client_isam_file.h +++ b/cde/lib/tt/lib/db/tt_client_isam_file.h @@ -44,7 +44,8 @@ class _Tt_client_isam_file : public _Tt_object { public: // Dummy constructor needed to make _tt_client_isam_file_utils.cc happy - _Tt_client_isam_file () {} + _Tt_client_isam_file () { currentRecordLength = 0; currentRecordNumber = 0; eraseFlag = 0; errorStatus = 0; + fileDescriptor = 0; fileMode = 0; maxRecordLength = 0; minRecordLength = 0; newFlag = 0; } // Real constructors _Tt_client_isam_file (const _Tt_string &file, diff --git a/cde/lib/tt/lib/db/tt_db_client.C b/cde/lib/tt/lib/db/tt_db_client.C index 808c5cfb..c2924440 100644 --- a/cde/lib/tt/lib/db/tt_db_client.C +++ b/cde/lib/tt/lib/db/tt_db_client.C @@ -84,6 +84,13 @@ _Tt_db_client::_Tt_db_client() setTtDBDefaults(); connectToDB(db_hostname); + iserrno = 0; + isrecnum = 0; + isreclen = 0; +#if !defined(OPT_TLI) + dbSocket.sin_family = 0; + dbSocket.sin_port = 0; +#endif } _Tt_db_client::_Tt_db_client (_Tt_db_results & status) diff --git a/cde/lib/tt/lib/db/tt_db_file.C b/cde/lib/tt/lib/db/tt_db_file.C index 4af667c7..0aa5891c 100644 --- a/cde/lib/tt/lib/db/tt_db_file.C +++ b/cde/lib/tt/lib/db/tt_db_file.C @@ -63,6 +63,11 @@ _Tt_db_file::_Tt_db_file (const _Tt_string &file) _Tt_db_access_ptr access; dbResults = setTtDBFileDefaults(file, properties, access); } + + checkedDatabase = FALSE; + directoryFlag = FALSE; + dbFileObjectsCacheLevel = -1; + dbFilePropertiesCacheLevel = -1; } _Tt_db_file::_Tt_db_file (const _Tt_string &file, @@ -75,6 +80,11 @@ _Tt_db_file::_Tt_db_file (const _Tt_string &file, else { dbResults = setTtDBFileDefaults(file, properties, access); } + + checkedDatabase = 0; + directoryFlag = 0; + dbFileObjectsCacheLevel = -1; + dbFilePropertiesCacheLevel = -1; } _Tt_db_results diff --git a/cde/lib/tt/lib/db/tt_old_db.C b/cde/lib/tt/lib/db/tt_old_db.C index ed39c90a..09553843 100644 --- a/cde/lib/tt/lib/db/tt_old_db.C +++ b/cde/lib/tt/lib/db/tt_old_db.C @@ -50,7 +50,9 @@ _Tt_old_db:: _Tt_old_db() { -} + propertyTableFD = 0; + dbResults = NULL; +} _Tt_old_db::_Tt_old_db (const _Tt_string &partition, const _Tt_db_client_ptr &db_conn) diff --git a/cde/lib/tt/lib/db/tt_old_db_message_info.C b/cde/lib/tt/lib/db/tt_old_db_message_info.C index c128fd25..23ef8b6f 100644 --- a/cde/lib/tt/lib/db/tt_old_db_message_info.C +++ b/cde/lib/tt/lib/db/tt_old_db_message_info.C @@ -37,6 +37,9 @@ _Tt_old_db_message_info:: _Tt_old_db_message_info () { + messageID = 0; + numParts = 0; + messageSize = 0; } _Tt_old_db_message_info:: diff --git a/cde/lib/tt/lib/mp/mp_file.C b/cde/lib/tt/lib/mp/mp_file.C index 60a92726..a186c784 100644 --- a/cde/lib/tt/lib/mp/mp_file.C +++ b/cde/lib/tt/lib/mp/mp_file.C @@ -49,6 +49,11 @@ _Tt_qmsg_info::_Tt_qmsg_info() categories = new _Tt_int_rec_list; ptypes = new _Tt_string_list; version = TT_QMSG_INFO_VERSION; + + id = 0; + nparts = 0; + size = 0; + m_id = 0; } _Tt_qmsg_info::~_Tt_qmsg_info() diff --git a/cde/lib/tt/lib/mp/mp_rpc_client.C b/cde/lib/tt/lib/mp/mp_rpc_client.C index 82697ec0..634832a1 100644 --- a/cde/lib/tt/lib/mp/mp_rpc_client.C +++ b/cde/lib/tt/lib/mp/mp_rpc_client.C @@ -88,6 +88,12 @@ _Tt_rpc_client(int conn_socket) { _socket = conn_socket; _client = (CLIENT *)0; + _program = 0; + _version = 0; + _server_uid = 0; + _clnt_stat = NULL; + _server_addr.sin_family = 0; + _server_addr.sin_port = 0; } diff --git a/cde/lib/tt/lib/mp/mp_session.C b/cde/lib/tt/lib/mp/mp_session.C index 73bbe185..e584b0e6 100644 --- a/cde/lib/tt/lib/mp/mp_session.C +++ b/cde/lib/tt/lib/mp/mp_session.C @@ -66,6 +66,10 @@ _Tt_session() _is_server = 0; // default server mode _is_dead = 0; _rpc_version = 0; + _pid = 0; + _rpc_program = 0; + _server_num = 0; + _server_uid = 0; } diff --git a/cde/lib/tt/lib/mp/mp_stream_socket.C b/cde/lib/tt/lib/mp/mp_stream_socket.C index f92215ff..8d08a0de 100644 --- a/cde/lib/tt/lib/mp/mp_stream_socket.C +++ b/cde/lib/tt/lib/mp/mp_stream_socket.C @@ -83,6 +83,11 @@ char *t_strerror(int t_errno) _Tt_stream_socket:: _Tt_stream_socket() { + _is_source = 0; + _msgsock = -1; + _sock = -1; + _hostaddr.sin_port = 0; + _hostaddr.sin_family = 0; } _Tt_stream_socket:: @@ -94,6 +99,8 @@ _Tt_stream_socket(_Tt_host_ptr &host, int portnum) _hostaddr.sin_addr.s_addr = htonl(INADDR_ANY); _hostaddr.sin_port = htons(portnum); _hostaddr.sin_family = AF_INET; + _is_source = 0; + _sock = -1; } diff --git a/cde/lib/tt/lib/util/tt_file_system_entry_utils.C b/cde/lib/tt/lib/util/tt_file_system_entry_utils.C index 0311fe23..7b4eb217 100644 --- a/cde/lib/tt/lib/util/tt_file_system_entry_utils.C +++ b/cde/lib/tt/lib/util/tt_file_system_entry_utils.C @@ -42,6 +42,8 @@ implement_list_of(_Tt_file_system_entry) _Tt_file_system_entry:: _Tt_file_system_entry () { + localFlag = 0; + loopBackFlag = 0; } _Tt_file_system_entry:: diff --git a/cde/lib/tt/lib/util/tt_host_equiv.C b/cde/lib/tt/lib/util/tt_host_equiv.C index 978a92d4..60e851b0 100644 --- a/cde/lib/tt/lib/util/tt_host_equiv.C +++ b/cde/lib/tt/lib/util/tt_host_equiv.C @@ -53,6 +53,7 @@ _Tt_hostname_cache:: _Tt_hostname_cache() { hostname = (_Tt_string) 0; + addr_length = 0; } _Tt_hostname_cache:: diff --git a/cde/lib/tt/lib/util/tt_int_rec.C b/cde/lib/tt/lib/util/tt_int_rec.C index 56fc930c..58cfa44d 100644 --- a/cde/lib/tt/lib/util/tt_int_rec.C +++ b/cde/lib/tt/lib/util/tt_int_rec.C @@ -76,6 +76,7 @@ implement_list_of(_Tt_int_rec) _Tt_pid_t_rec:: _Tt_pid_t_rec() { + val = 0; } diff --git a/cde/lib/tt/slib/mp_observer.C b/cde/lib/tt/slib/mp_observer.C index 1e58a7b8..34f5f2f1 100644 --- a/cde/lib/tt/slib/mp_observer.C +++ b/cde/lib/tt/slib/mp_observer.C @@ -48,6 +48,9 @@ _Tt_observer() _ptid = (char *)0; _reliability = TT_DISCARD; _opnum = -1; + + _scope = NULL; + _state = TT_STATE_LAST; // BUG This class member is not set anywhere, but a getter function exists } @@ -59,7 +62,7 @@ _Tt_observer(_Tt_string ptid, int opnum, _reliability = reliability; _opnum = opnum; _scope = s; - + _state = TT_STATE_LAST; // BUG This class member is not set anywhere, but a getter function exists } diff --git a/cde/lib/tt/slib/mp_rpc_server.h b/cde/lib/tt/slib/mp_rpc_server.h index aeba0e38..85bfa636 100644 --- a/cde/lib/tt/slib/mp_rpc_server.h +++ b/cde/lib/tt/slib/mp_rpc_server.h @@ -43,7 +43,7 @@ class _Tt_rpc_server : public _Tt_object { public: - _Tt_rpc_server() {}; + _Tt_rpc_server() { _version = 0; _socket = 0; _program = 0; _rpc_fd = 0; _transp = NULL; }; _Tt_rpc_server(int program, int version, int Rsocket, _Tt_auth &auth); virtual ~_Tt_rpc_server(); int init(void (*service_fn)(svc_req *, SVCXPRT *)); diff --git a/cde/lib/tt/slib/mp_s_message.C b/cde/lib/tt/slib/mp_s_message.C index cbe6afb9..fe9a610d 100644 --- a/cde/lib/tt/slib/mp_s_message.C +++ b/cde/lib/tt/slib/mp_s_message.C @@ -160,6 +160,7 @@ _Tt_s_message(_Tt_s_message *m, _Tt_observer_ptr &o) _rsessions = m->_rsessions; _when_last_matched = m->_when_last_matched; _original = m; + _num_recipients_yet_to_vote = 0; } // diff --git a/cde/lib/tt/slib/mp_s_mp.C b/cde/lib/tt/slib/mp_s_mp.C index c3deefcd..7a772e30 100644 --- a/cde/lib/tt/slib/mp_s_mp.C +++ b/cde/lib/tt/slib/mp_s_mp.C @@ -94,6 +94,11 @@ _Tt_s_mp() : _Tt_mp() when_last_observer_registered = 1; update_args.message = new _Tt_s_message(); _self = (_Tt_s_procid *)new _Tt_self_procid(); + + map_ptypes = 0; + unix_cred_chk_flag = 0; + garbage_collector_pid = 0; + _next_garbage_run = 0; } diff --git a/cde/lib/tt/slib/mp_s_procid.C b/cde/lib/tt/slib/mp_s_procid.C index 96a1522b..fb54cb0e 100644 --- a/cde/lib/tt/slib/mp_s_procid.C +++ b/cde/lib/tt/slib/mp_s_procid.C @@ -66,7 +66,7 @@ _Tt_s_procid(const _Tt_s_procid_ptr &p) _proc_host_ipaddr = p->_proc_host_ipaddr; _pid = p->_pid; _id = p->_id; - + _itimeout = -1; } _Tt_s_procid::