|
|
5865da5 |
From 50c3f30d610ed9979a1291422e8641e05f881212 Mon Sep 17 00:00:00 2001
|
|
|
5865da5 |
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
|
|
|
5865da5 |
Date: Tue, 5 Nov 2019 14:20:46 +0100
|
|
|
5865da5 |
Subject: [PATCH] warnquota: Initialize all members of a configparams structure
|
|
|
5865da5 |
MIME-Version: 1.0
|
|
|
5865da5 |
Content-Type: text/plain; charset=UTF-8
|
|
|
5865da5 |
Content-Transfer-Encoding: 8bit
|
|
|
5865da5 |
|
|
|
5865da5 |
Running warnquota under valgrind reported many "Conditional jump or
|
|
|
5865da5 |
move depends on uninitialised value" mistakes because readconfigfile()
|
|
|
5865da5 |
did not initizalize ldap_bindpw member if some of the configuration
|
|
|
5865da5 |
options were missing from the configuration file.
|
|
|
5865da5 |
|
|
|
5865da5 |
This patch simply initializes all bytes of the configparams structure
|
|
|
5865da5 |
to 0 instead of settting each of the members explicitly.
|
|
|
5865da5 |
|
|
|
5865da5 |
Signed-off-by: Petr Písař <ppisar@redhat.com>
|
|
|
5865da5 |
---
|
|
|
5865da5 |
warnquota.c | 8 +-------
|
|
|
5865da5 |
1 file changed, 1 insertion(+), 7 deletions(-)
|
|
|
5865da5 |
|
|
|
5865da5 |
diff --git a/warnquota.c b/warnquota.c
|
|
|
5865da5 |
index f6b42d5..2882fee 100644
|
|
|
5865da5 |
--- a/warnquota.c
|
|
|
5865da5 |
+++ b/warnquota.c
|
|
|
5865da5 |
@@ -759,13 +759,13 @@ static int readconfigfile(const char *filename, struct configparams *config)
|
|
|
5865da5 |
char *locale;
|
|
|
5865da5 |
|
|
|
5865da5 |
/* set default values */
|
|
|
5865da5 |
+ memset(config, 0, sizeof(*config));
|
|
|
5865da5 |
sstrncpy(config->mail_cmd, MAIL_CMD, CNF_BUFFER);
|
|
|
5865da5 |
sstrncpy(config->from, FROM, CNF_BUFFER);
|
|
|
5865da5 |
sstrncpy(config->subject, SUBJECT, CNF_BUFFER);
|
|
|
5865da5 |
sstrncpy(config->cc_to, CC_TO, CNF_BUFFER);
|
|
|
5865da5 |
sstrncpy(config->support, SUPPORT, CNF_BUFFER);
|
|
|
5865da5 |
sstrncpy(config->phone, PHONE, CNF_BUFFER);
|
|
|
5865da5 |
- (config->charset)[0] = '\0';
|
|
|
5865da5 |
setlocale(LC_ALL, NULL);
|
|
|
5865da5 |
locale = setlocale(LC_MESSAGES, NULL);
|
|
|
5865da5 |
#ifdef HAVE_NL_LANGINFO
|
|
|
5865da5 |
@@ -775,17 +775,11 @@ static int readconfigfile(const char *filename, struct configparams *config)
|
|
|
5865da5 |
}
|
|
|
5865da5 |
#endif
|
|
|
5865da5 |
maildev[0] = 0;
|
|
|
5865da5 |
- config->user_signature = config->user_message = config->group_signature = config->group_message = NULL;
|
|
|
5865da5 |
config->cc_before = -1;
|
|
|
5865da5 |
|
|
|
5865da5 |
#ifdef USE_LDAP_MAIL_LOOKUP
|
|
|
5865da5 |
- config->use_ldap_mail = 0;
|
|
|
5865da5 |
- config->ldap_starttls = 0;
|
|
|
5865da5 |
config->ldap_tls = LDAP_OPT_X_TLS_NEVER;
|
|
|
5865da5 |
config->ldap_vers = LDAP_VERSION3;
|
|
|
5865da5 |
- config->ldap_port = config->ldap_is_setup = 0;
|
|
|
5865da5 |
- config->ldap_host[0] = 0;
|
|
|
5865da5 |
- config->ldap_uri[0] = 0;
|
|
|
5865da5 |
#endif
|
|
|
5865da5 |
|
|
|
5865da5 |
if (!(fp = fopen(filename, "r"))) {
|
|
|
5865da5 |
--
|
|
|
5865da5 |
2.21.0
|
|
|
5865da5 |
|