summaryrefslogtreecommitdiff
path: root/src/analysis
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2018-04-02 14:43:47 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2018-04-02 14:43:47 (GMT)
commitf9404bf68a067b06986cd85855c43795ec578dbd (patch)
tree57f481aced2c69ddf6ac9766f310be86ebe03f6f /src/analysis
parentd69503d7aeceddc52dfee9481e6a0e8ba9c1fc85 (diff)
Removed lots of uninitialized uses, mostly in NDEBUG mode.
Diffstat (limited to 'src/analysis')
-rw-r--r--src/analysis/binary.c1
-rw-r--r--src/analysis/db/certs.c2
-rw-r--r--src/analysis/db/item.c6
-rw-r--r--src/analysis/db/misc/rlestr.c3
-rw-r--r--src/analysis/db/server.c24
-rw-r--r--src/analysis/disass/output.c5
6 files changed, 30 insertions, 11 deletions
diff --git a/src/analysis/binary.c b/src/analysis/binary.c
index 1a93470..606b753 100644
--- a/src/analysis/binary.c
+++ b/src/analysis/binary.c
@@ -1838,6 +1838,7 @@ static GtkWidget *g_loaded_binary_build_view(GLoadedBinary *binary, unsigned int
default:
assert(false);
+ display = NULL;
break;
}
diff --git a/src/analysis/db/certs.c b/src/analysis/db/certs.c
index 083ef7d..6b8037b 100644
--- a/src/analysis/db/certs.c
+++ b/src/analysis/db/certs.c
@@ -192,6 +192,8 @@ static RSA *generate_rsa_key(unsigned int bits, unsigned long e)
BIGNUM *bne; /* Autre version de l'exposant */
int ret; /* Bilan d'un appel */
+ result = NULL;
+
bne = BN_new();
if (bne == NULL)
{
diff --git a/src/analysis/db/item.c b/src/analysis/db/item.c
index d2c1652..e16ce56 100644
--- a/src/analysis/db/item.c
+++ b/src/analysis/db/item.c
@@ -117,10 +117,16 @@ static void g_db_item_class_init(GDbItemClass *klass)
static void g_db_item_init(GDbItem *item)
{
const char *author; /* Identification à diffuser */
+#ifndef NDEBUG
bool status; /* Bilan d'une obtention */
+#endif
+#ifndef NDEBUG
status = g_generic_config_get_value(get_main_configuration(), MPK_AUTHOR_NAME, &author);
assert(status);
+#else
+ g_generic_config_get_value(get_main_configuration(), MPK_AUTHOR_NAME, &author);
+#endif
set_static_rle_string(&item->author, author);
diff --git a/src/analysis/db/misc/rlestr.c b/src/analysis/db/misc/rlestr.c
index c1d2d95..43bbac4 100644
--- a/src/analysis/db/misc/rlestr.c
+++ b/src/analysis/db/misc/rlestr.c
@@ -265,8 +265,7 @@ bool unpack_rle_string(rle_string *str, packed_buffer *pbuf)
bool result; /* Bilan à retourner */
uint32_t tmp32; /* Valeur sur 32 bits */
- str->data = NULL;
- str->length = 0;
+ unset_rle_string(str);
result = extract_packed_buffer(pbuf, &tmp32, sizeof(uint32_t), true);
diff --git a/src/analysis/db/server.c b/src/analysis/db/server.c
index bbc7415..d0ce62b 100644
--- a/src/analysis/db/server.c
+++ b/src/analysis/db/server.c
@@ -552,6 +552,8 @@ static void *g_db_server_listener(GDbServer *server)
int ret; /* Bilan d'un appel */
gen_sockaddr_t peer; /* Adresse cliente */
int fd; /* Canal établi vers un client */
+ rle_string hash; /* Empreinte du binaire visé */
+ rle_string user; /* Nom d'utilisateur du client */
const char *ip; /* Statut de la conversion */
char *peer_name; /* Désignation du correspondant*/
DBError error; /* Validation de la connexion */
@@ -560,8 +562,6 @@ static void *g_db_server_listener(GDbServer *server)
bool status; /* Bilan d'une opération */
uint32_t cmd; /* Commande initiale lue */
uint32_t version; /* Version du client lue */
- rle_string hash; /* Empreinte du binaire visé */
- rle_string user; /* Nom d'utilisateur du client */
unsigned char sig[RSA_USED_SIZE]; /* Signature effectuée */
GList *iter; /* Boucle de parcours */
packed_buffer out_pbuf; /* Tampon d'émission */
@@ -587,6 +587,11 @@ static void *g_db_server_listener(GDbServer *server)
continue;
}
+ /* Initialisation à vide pour les sorties en erreur */
+
+ init_dynamic_rle_string(&hash, NULL);
+ init_dynamic_rle_string(&user, NULL);
+
/* Construction d'une représentation */
if (*((sa_family_t *)&peer) == AF_UNIX)
@@ -607,6 +612,9 @@ static void *g_db_server_listener(GDbServer *server)
}
+ else
+ goto gdsl_invalid;
+
error = DBE_NONE;
archive = NULL;
@@ -747,13 +755,13 @@ static void *g_db_server_listener(GDbServer *server)
init_packed_buffer(&out_pbuf);
status = extend_packed_buffer(&out_pbuf, (uint32_t []) { DBC_WELCOME }, sizeof(uint32_t), true);
- if (!status) goto gdsl_error;
+ if (!status) goto gdsl_out_error;
status = extend_packed_buffer(&out_pbuf, (uint32_t []) { error }, sizeof(uint32_t), true);
- if (!status) goto gdsl_error;
+ if (!status) goto gdsl_out_error;
status = send_packed_buffer(&out_pbuf, fd);
- if (!status) goto gdsl_error;
+ if (!status) goto gdsl_out_error;
exit_packed_buffer(&out_pbuf);
@@ -781,15 +789,19 @@ static void *g_db_server_listener(GDbServer *server)
assert(error != DBE_NONE);
- gdsl_error:
+ gdsl_out_error:
exit_packed_buffer(&out_pbuf);
+ gdsl_error:
+
free(peer_name);
exit_rle_string(&hash);
exit_rle_string(&user);
+ gdsl_invalid:
+
close(fd);
}
diff --git a/src/analysis/disass/output.c b/src/analysis/disass/output.c
index 19c7de9..a1c0718 100644
--- a/src/analysis/disass/output.c
+++ b/src/analysis/disass/output.c
@@ -206,10 +206,9 @@ void print_disassembled_instructions(GBufferCache *cache, GCodingLanguage *lang,
/* Début d'un nouveau symbole ? */
- if (symbol == NULL)
- compared = -1;
+ compared = -1;
- else
+ if (symbol != NULL)
{
iaddr = get_mrange_addr(g_arch_instruction_get_range(instr));