[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Nmh-workers] [patch] gcc warnings: possible use of uninitialized data
From: |
markus schnalke |
Subject: |
[Nmh-workers] [patch] gcc warnings: possible use of uninitialized data |
Date: |
Fri, 05 Nov 2010 21:39:19 +0100 |
User-agent: |
nmh 1.3 |
Hoi,
gcc spits out warnings of this kind:
inc.c:239: warning: āiā may be used uninitialized in this function
I don't know if this is an issue.
Removing them was easy by initialising the variables. See attached
patch. As far as I had seen the data does get initialized before use,
but there may exist corner-cases which I missed.
If you don't consider it worth to apply this patch, I don't mind.
meillo
diff -r 7e963436013a mts/smtp/smtp.c
--- a/mts/smtp/smtp.c Fri Nov 05 10:56:54 2010 -0300
+++ b/mts/smtp/smtp.c Fri Nov 05 16:36:28 2010 -0300
@@ -1208,7 +1208,7 @@
static int
smhear (void)
{
- int i, code, cont, bc, rc, more;
+ int i, code, cont, bc = 0, rc, more;
unsigned char *bp;
char *rp;
char **ehlo = NULL, buffer[BUFSIZ];
@@ -1326,6 +1326,9 @@
}
+/*
+len will geht initialized by this function
+*/
static int
sm_rrecord (char *buffer, int *len)
{
diff -r 7e963436013a sbr/fmt_rfc2047.c
--- a/sbr/fmt_rfc2047.c Fri Nov 05 10:56:54 2010 -0300
+++ b/sbr/fmt_rfc2047.c Fri Nov 05 16:36:28 2010 -0300
@@ -239,6 +239,7 @@
/* base64 */
int c1, c2, c3, c4;
+ c1 = c2 = c3 = c4 = 0;
pp = startofmime;
while (pp < endofmime) {
/* 6 + 2 bits */
diff -r 7e963436013a sbr/folder_addmsg.c
--- a/sbr/folder_addmsg.c Fri Nov 05 10:56:54 2010 -0300
+++ b/sbr/folder_addmsg.c Fri Nov 05 16:36:28 2010 -0300
@@ -22,7 +22,7 @@
folder_addmsg (struct msgs **mpp, char *msgfile, int selected,
int unseen, int preserve, int deleting, char *from_dir)
{
- int infd, outfd, linkerr, first_time, msgnum;
+ int infd, outfd, linkerr, first_time, msgnum = 0;
char *nmsg, newmsg[BUFSIZ];
char oldmsg[BUFSIZ];
struct msgs *mp;
diff -r 7e963436013a uip/inc.c
--- a/uip/inc.c Fri Nov 05 10:56:54 2010 -0300
+++ b/uip/inc.c Fri Nov 05 16:36:28 2010 -0300
@@ -236,7 +236,7 @@
{
int chgflag = 1, trnflag = 1;
int noisy = 1, width = 0;
- int rpop, i, hghnum = 0, msgnum = 0;
+ int rpop, i = 0, hghnum = 0, msgnum = 0;
int kpop = 0, sasl = 0;
char *cp, *maildir = NULL, *folder = NULL;
char *format = NULL, *form = NULL;
diff -r 7e963436013a uip/new.c
--- a/uip/new.c Fri Nov 05 10:56:54 2010 -0300
+++ b/uip/new.c Fri Nov 05 16:36:28 2010 -0300
@@ -297,7 +297,7 @@
static struct node *
doit(char *cur, char *folders, char *sequences[])
{
- struct node *first, *cur_node, *node, *last, *prev;
+ struct node *first, *cur_node, *node, *last = NULL, *prev;
size_t folder_len;
int count, total = 0;
char *command = NULL, *sequences_s = NULL;
- [Nmh-workers] [patch] gcc warnings: possible use of uninitialized data,
markus schnalke <=