summaryrefslogtreecommitdiff
path: root/pith/conf.c
diff options
context:
space:
mode:
authorEduardo Chappa <chappa@washington.edu>2019-03-29 09:49:05 -0600
committerEduardo Chappa <chappa@washington.edu>2019-03-29 09:49:05 -0600
commit3443fe5fcfcb33d3a2510111855e619632de57df (patch)
treec7fafde85d5d23e3e51a04f5cbc41a38297c2f6a /pith/conf.c
parent0707eb6d0053079b4f91849bba2f8b6fc97391e8 (diff)
downloadalpine-3443fe5fcfcb33d3a2510111855e619632de57df.tar.xz
* Patches from Michał Dardas and Mateusz Kocielski from LogicalTrust
that fix the following startup crashes: * Crash when Alpine started with empty url fragment; * Crash when Alpine started with option last-time-prune-questioned in wrong format; * Crash when Alpine started with printf formatting characters from command line; and * Crash when Alpine started with an extremely long command line option. * Crash when Alpine is started with the wrong piped input when opening a folder from the command line. Reported by Mateusz Kocielski from LogicalTrust.
Diffstat (limited to 'pith/conf.c')
-rw-r--r--pith/conf.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/pith/conf.c b/pith/conf.c
index c7c24dbe..3742e9ab 100644
--- a/pith/conf.c
+++ b/pith/conf.c
@@ -1587,7 +1587,7 @@ based on the contents.
void
init_vars(struct pine *ps, void (*cmds_f) (struct pine *, char **))
{
- char buf[MAXPATH+1], *p, *q, **s;
+ char buf[MAXPATH+1], *p, *q, **s, *comma_index;
register struct variable *vars = ps->vars;
int obs_header_in_reply = 0, /* the obs_ variables are to */
obs_old_style_reply = 0, /* support backwards compatibility */
@@ -1992,13 +1992,13 @@ init_vars(struct pine *ps, void (*cmds_f) (struct pine *, char **))
printer_value_check_and_adjust();
set_current_val(&vars[V_LAST_TIME_PRUNE_QUESTION], TRUE, TRUE);
- if(VAR_LAST_TIME_PRUNE_QUESTION != NULL){
+ if(VAR_LAST_TIME_PRUNE_QUESTION != NULL &&
+ (comma_index = strindex(VAR_LAST_TIME_PRUNE_QUESTION, '.')) != NULL){
/* The month value in the file runs from 1-12, the variable here
runs from 0-11; the value in the file used to be 0-11, but we're
fixing it in January */
ps->last_expire_year = atoi(VAR_LAST_TIME_PRUNE_QUESTION);
- ps->last_expire_month =
- atoi(strindex(VAR_LAST_TIME_PRUNE_QUESTION, '.') + 1);
+ ps->last_expire_month = atoi(comma_index + 1);
if(ps->last_expire_month == 0){
/* Fix for 0 because of old bug */
snprintf(buf, sizeof(buf), "%d.%d", ps_global->last_expire_year,