Still hunting down uninitialized variables
This commit is contained in:
parent
319e0ac8ce
commit
46b9578cad
3 changed files with 30 additions and 8 deletions
|
@ -259,10 +259,15 @@ bool event_loop(void) {
|
|||
|
||||
while(running) {
|
||||
struct timeval diff;
|
||||
struct timeval *tv = get_time_remaining(&diff);
|
||||
struct timeval *tv = NULL;
|
||||
|
||||
|
||||
memset(&diff, 0x0, sizeof diff);
|
||||
memcpy(&readable, &readfds, sizeof readable);
|
||||
memcpy(&writable, &writefds, sizeof writable);
|
||||
|
||||
tv = get_time_remaining(&diff);
|
||||
|
||||
int fds = 0;
|
||||
|
||||
if(io_tree.tail) {
|
||||
|
|
|
@ -498,10 +498,11 @@ bool metakey_h(connection_t *c, const char *request) {
|
|||
char enckey[len];
|
||||
char key[len];
|
||||
|
||||
bzero(key, len);
|
||||
bzero(enckey, len);
|
||||
memset(&key, 0x0, len);
|
||||
memset(&enckey, 0x0, len);
|
||||
memset(&hexkey,0x0, MAX_STRING_SIZE);
|
||||
|
||||
cipher = digest = maclength =compression = 0;
|
||||
cipher = digest = maclength = compression = -1;
|
||||
|
||||
if(sscanf(request, "%*d %d %d %d %d " MAX_STRING, &cipher, &digest, &maclength, &compression, hexkey) != 5) {
|
||||
logger(DEBUG_ALWAYS, LOG_ERR, "Got bad %s from %s (%s)", "METAKEY", c->name, c->hostname);
|
||||
|
|
|
@ -58,7 +58,7 @@ void send_key_changed(void) {
|
|||
bool key_changed_h(connection_t *c, const char *request) {
|
||||
char name[MAX_STRING_SIZE];
|
||||
node_t *n;
|
||||
|
||||
memset(&name, 0x0, MAX_STRING_SIZE);
|
||||
if(sscanf(request, "%*d %*x " MAX_STRING, name) != 1) {
|
||||
logger(DEBUG_ALWAYS, LOG_ERR, "Got bad %s from %s (%s)", "KEY_CHANGED",
|
||||
c->name, c->hostname);
|
||||
|
@ -136,6 +136,7 @@ static bool req_key_ext_h(connection_t *c, const char *request, node_t *from, no
|
|||
|
||||
char buf[MAX_STRING_SIZE];
|
||||
int len;
|
||||
memset(&buf, 0x0, MAX_STRING_SIZE);
|
||||
if(sscanf(request, "%*d %*s %*s %*d " MAX_STRING, buf) != 1 || !(len = b64decode(buf, buf, strlen(buf)))) {
|
||||
logger(DEBUG_ALWAYS, LOG_ERR, "Got bad %s from %s (%s) to %s (%s): %s", "SPTPS_PACKET", from->name, from->hostname, to->name, to->hostname, "invalid SPTPS data");
|
||||
return true;
|
||||
|
@ -190,6 +191,7 @@ static bool req_key_ext_h(connection_t *c, const char *request, node_t *from, no
|
|||
}
|
||||
|
||||
char pubkey[MAX_STRING_SIZE];
|
||||
memset(&pubkey, 0x0, MAX_STRING_SIZE);
|
||||
if(sscanf(request, "%*d %*s %*s %*d " MAX_STRING, pubkey) != 1 || !(from->ecdsa = ecdsa_set_base64_public_key(pubkey))) {
|
||||
logger(DEBUG_ALWAYS, LOG_ERR, "Got bad %s from %s (%s): %s", "ANS_PUBKEY", from->name, from->hostname, "invalid pubkey");
|
||||
return true;
|
||||
|
@ -211,7 +213,9 @@ static bool req_key_ext_h(connection_t *c, const char *request, node_t *from, no
|
|||
logger(DEBUG_ALWAYS, LOG_DEBUG, "Got REQ_KEY from %s while we already started a SPTPS session!", from->name);
|
||||
|
||||
char buf[MAX_STRING_SIZE];
|
||||
int len;
|
||||
int len = -1;
|
||||
|
||||
memset(&buf, 0x0, MAX_STRING_SIZE);
|
||||
|
||||
if(sscanf(request, "%*d %*s %*s %*d " MAX_STRING, buf) != 1 || !(len = b64decode(buf, buf, strlen(buf)))) {
|
||||
logger(DEBUG_ALWAYS, LOG_ERR, "Got bad %s from %s (%s): %s", "REQ_SPTPS_START", from->name, from->hostname, "invalid SPTPS data");
|
||||
|
@ -242,6 +246,9 @@ bool req_key_h(connection_t *c, const char *request) {
|
|||
node_t *from, *to;
|
||||
int reqno = 0;
|
||||
|
||||
memset(&from_name, 0x0, MAX_STRING_SIZE);
|
||||
memset(&to_name, 0x0, MAX_STRING_SIZE);
|
||||
|
||||
if(sscanf(request, "%*d " MAX_STRING " " MAX_STRING " %d", from_name, to_name, &reqno) < 2) {
|
||||
logger(DEBUG_ALWAYS, LOG_ERR, "Got bad %s from %s (%s)", "REQ_KEY", c->name,
|
||||
c->hostname);
|
||||
|
@ -354,11 +361,20 @@ bool ans_key_h(connection_t *c, const char *request) {
|
|||
char from_name[MAX_STRING_SIZE];
|
||||
char to_name[MAX_STRING_SIZE];
|
||||
char key[MAX_STRING_SIZE];
|
||||
char address[MAX_STRING_SIZE] = "";
|
||||
char port[MAX_STRING_SIZE] = "";
|
||||
char address[MAX_STRING_SIZE];
|
||||
char port[MAX_STRING_SIZE];
|
||||
int cipher, digest, maclength, compression, keylen;
|
||||
node_t *from, *to;
|
||||
|
||||
from = to = NULL;
|
||||
|
||||
cipher = digest = maclength = compression = keylen = -1;
|
||||
memset(&from_name, 0x0, MAX_STRING_SIZE);
|
||||
memset(&to_name, 0x0, MAX_STRING_SIZE);
|
||||
memset(&key, 0x0, MAX_STRING_SIZE);
|
||||
memset(&address, 0x0, MAX_STRING_SIZE);
|
||||
memset(&port, 0x0, MAX_STRING_SIZE);
|
||||
|
||||
if(sscanf(request, "%*d "MAX_STRING" "MAX_STRING" "MAX_STRING" %d %d %d %d "MAX_STRING" "MAX_STRING,
|
||||
from_name, to_name, key, &cipher, &digest, &maclength,
|
||||
&compression, address, port) < 7) {
|
||||
|
|
Loading…
Reference in a new issue