summaryrefslogtreecommitdiff
path: root/pith
diff options
context:
space:
mode:
authorEduardo Chappa <chappa@washington.edu>2021-05-08 21:01:02 -0600
committerEduardo Chappa <chappa@washington.edu>2021-05-08 21:01:02 -0600
commitb5eb45a153202d72aeb48de1149e7c74aef979fd (patch)
tree1fbc156a717e7963cd0c02fd7352bc801949c550 /pith
parent2f953255a8c494e3033015eb064c6ecace9ffeda (diff)
downloadalpine-master.tar.xz
* Clear out some gcc warnings, and code improvement. Work in progress.HEADmaster
Diffstat (limited to 'pith')
-rw-r--r--pith/mailcmd.c17
-rw-r--r--pith/osdep/pipe.c5
-rw-r--r--pith/reply.c4
-rw-r--r--pith/smime.c14
-rw-r--r--pith/string.c4
5 files changed, 23 insertions, 21 deletions
diff --git a/pith/mailcmd.c b/pith/mailcmd.c
index 098dd8a..2c2b07d 100644
--- a/pith/mailcmd.c
+++ b/pith/mailcmd.c
@@ -650,7 +650,7 @@ do_broach_folder(char *newfolder, CONTEXT_S *new_context, MAILSTREAM **streamp,
ps_global->context_last = ps_global->context_current;
snprintf(ps_global->context_current->last_folder,
sizeof(ps_global->context_current->last_folder),
- "%s", ps_global->cur_folder);
+ "%.*s", (int) sizeof(ps_global->context_current->last_folder) - 1,ps_global->cur_folder);
ps_global->last_unambig_folder[0] = '\0';
}
else{
@@ -958,7 +958,7 @@ do_broach_folder(char *newfolder, CONTEXT_S *new_context, MAILSTREAM **streamp,
ps_global->context_last = ps_global->context_current;
snprintf(ps_global->context_current->last_folder,
sizeof(ps_global->context_current->last_folder),
- "%s", ps_global->cur_folder);
+ "%.*s", (int) sizeof(ps_global->context_current->last_folder) - 1, ps_global->cur_folder);
ps_global->last_unambig_folder[0] = '\0';
}
else{
@@ -2340,7 +2340,7 @@ agg_text_select(MAILSTREAM *stream, MSGNO_S *msgmap, char type, char *namehdr,
}
}
- if(!mepgm)
+ if(!mepgm){
switch(type){
case 'g' : /* X-GM-EXT-1 */
pgm->x_gm_ext1 = mail_newstringlist();
@@ -2449,7 +2449,7 @@ agg_text_select(MAILSTREAM *stream, MSGNO_S *msgmap, char type, char *namehdr,
dprint((1,"\n - BOTCH: select_text unrecognized type\n"));
return(1);
}
-
+ }
/*
* If we happen to have any messages excluded, make sure we
* don't waste time searching their text...
@@ -2502,11 +2502,10 @@ agg_text_select(MAILSTREAM *stream, MSGNO_S *msgmap, char type, char *namehdr,
* bits.
*/
for(msgno = 1L; msgno <= mn_get_total(msgmap); msgno++)
- if(stream && msgno <= stream->nmsgs
- && (mc=mail_elt(stream, msgno)) && mc->searched)
- mc->searched = NIL;
- else
- mc->searched = T;
+ if(stream && msgno <= stream->nmsgs){
+ if((mc = mail_elt(stream, msgno)) != NULL)
+ mc->searched = mc->searched ? NIL : T;
+ }
}
if(we_cancel)
diff --git a/pith/osdep/pipe.c b/pith/osdep/pipe.c
index 47a00bd..1e47e83 100644
--- a/pith/osdep/pipe.c
+++ b/pith/osdep/pipe.c
@@ -481,10 +481,11 @@ open_system_pipe(char *command, char **outfile, char **errfile, int mode,
char *
pipe_error_msg(char *cmd, char *op, char *res)
{
- static char ebuf[512];
+ static char ebuf[512 + 16 + 1];
- snprintf(ebuf, 256, "Pipe can't %.256s \"%.32sb\": %.223s",
+ snprintf(ebuf, sizeof(ebuf), "Pipe can't %.256s \"%.32sb\": %.223s",
op ? op : "?", cmd ? cmd : "?", res ? res : "?");
+ ebuf[sizeof(ebuf) - 1] = '\0';
return(ebuf);
}
diff --git a/pith/reply.c b/pith/reply.c
index 49aaf33..636afa4 100644
--- a/pith/reply.c
+++ b/pith/reply.c
@@ -945,7 +945,7 @@ reply_body(MAILSTREAM *stream, ENVELOPE *env, struct mail_bodystruct *orig_body,
int impl, template_len = 0, leave_cursor_at_top = 0, reply_raw_body = 0;
if(sect_prefix) /* SECTBUFLEN = sizeof(sect_buf) */
- snprintf(section = sect_buf, sizeof(sect_buf), "%.*s.1", SECTBUFLEN-1, sect_prefix);
+ snprintf(section = sect_buf, sizeof(sect_buf), "%.*s.1", SECTBUFLEN-3, sect_prefix);
else
section = "1";
@@ -3064,7 +3064,7 @@ partno(struct mail_bodystruct *body, struct mail_bodystruct *end_body)
num++; /* PARTTMPLEN = sizeof(tmp) */
if(&part->body == end_body || (p = partno(&part->body, end_body))){
snprintf(tmp, sizeof(tmp), "%d%s%.*s", num, (p) ? "." : "",
- PARTTMPLEN-10, (p) ? p : "");
+ PARTTMPLEN-12, (p) ? p : "");
tmp[sizeof(tmp)-1] = '\0';
if(p)
fs_give((void **)&p);
diff --git a/pith/smime.c b/pith/smime.c
index 07e2291..0ef77e5 100644
--- a/pith/smime.c
+++ b/pith/smime.c
@@ -203,7 +203,7 @@ setup_pwdcert(void **pwdcert)
struct stat sbuf;
char pathdir[MAXPATH+1], pathkey[MAXPATH+1], fpath[MAXPATH+1], pathcert[MAXPATH+1];
char fpath2[MAXPATH+1], prompt[MAILTMPLEN];
- char *keyfile, *certfile, *text;
+ char *keyfile, *certfile, *text = NULL;
EVP_PKEY *pkey = NULL;
X509 *pcert = NULL;
PERSONAL_CERT *pc, *pc2 = NULL;
@@ -445,7 +445,7 @@ setup_pwdcert(void **pwdcert)
int
smime_expunge_cert(WhichCerts ctype)
{
- int count, removed;
+ int count = 0, removed;
CertList *cl, *dummy, *data;
char *path, buf[MAXPATH+1];
char *contents;
@@ -640,7 +640,7 @@ import_certificate(WhichCerts ctype, PERSONAL_CERT *p_cert, char *fname)
if(ctype == Password){
char PrivateKeyPath[MAXPATH+1], PublicCertPath[MAXPATH+1], s[MAXPATH+1];
char full_name_key[MAXPATH+1], full_name_cert[MAXPATH+1];
- char *use_this_file;
+ char *use_this_file = NULL;
char prompt[500];
EVP_PKEY *key = p_cert ? p_cert->key : NULL;
@@ -1151,15 +1151,16 @@ app_RAND_write_file(const char *file)
CertList *
certlist_from_personal_certs(PERSONAL_CERT *pc)
{
- CertList *cl;
+ CertList *cl = NULL;
X509 *x;
if(pc == NULL)
return NULL;
- if((x = get_cert_for(pc->name, Public, 1)) != NULL)
+ if((x = get_cert_for(pc->name, Public, 1)) != NULL){
cl = smime_X509_to_cert_info(x, pc->name);
- cl->next = certlist_from_personal_certs(pc->next);
+ cl->next = certlist_from_personal_certs(pc->next);
+ }
return cl;
}
@@ -3067,6 +3068,7 @@ do_detached_signature_verify(BODY *b, long msgno, char *section)
dprint((9, "do_detached_signature_verify(msgno=%ld type=%d subtype=%s section=%s)", msgno, b->type, b->subtype ? b->subtype : "NULL", (section && *section) ? section : (section != NULL) ? "Top" : "NULL"));
smime_init();
+ mimetext = bodytext = NULL;
/* if it was signed and then encrypted, use the decrypted text
* to check the validity of the signature
diff --git a/pith/string.c b/pith/string.c
index 8b79347..d2d0d75 100644
--- a/pith/string.c
+++ b/pith/string.c
@@ -1309,7 +1309,7 @@ convert_date_to_local(char *date)
{
struct tm *tm;
time_t ltime;
- static char datebuf[26];
+ static char datebuf[30];
ltime = date_to_local_time_t(date);
if(ltime == (time_t) -1)
@@ -1425,7 +1425,7 @@ byte_string(long int bytes)
char *a, aa[5];
char *abbrevs = "GMK";
long i, ones, tenths;
- static char string[10];
+ static char string[50];
ones = 0L;
tenths = 0L;