summaryrefslogtreecommitdiff
path: root/alpine
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 /alpine
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 'alpine')
-rw-r--r--alpine/alpine.c18
-rw-r--r--alpine/mailview.c19
2 files changed, 22 insertions, 15 deletions
diff --git a/alpine/alpine.c b/alpine/alpine.c
index 11f3354e..e0a914ae 100644
--- a/alpine/alpine.c
+++ b/alpine/alpine.c
@@ -278,12 +278,18 @@ main(int argc, char **argv)
dup2(STDIN_FD, PIPED_FD); /* redirected stdin to new desc */
dup2(STDERR_FD, STDIN_FD); /* rebind stdin to the tty */
stdin_getc = read_stdin_char;
- if(stdin_getc && args.action == aaURL){
- display_args_err(
+ if(stdin_getc){
+ if(args.action == aaURL){
+ display_args_err(
"Cannot read stdin when using -url\nFor mailto URLs, use \'body=\' instead",
- NULL, 1);
- args_help();
- exit(-1);
+ NULL, 1);
+ args_help();
+ exit(-1);
+ } else if (args.action == aaFolder){
+ display_args_err("Cannot take input from pipe when opening a folder", NULL, 1);
+ args_help();
+ exit(-1);
+ }
}
}
@@ -445,7 +451,7 @@ main(int argc, char **argv)
mail_parameters(NULL, SET_SSLFAILURE, (void *) pine_sslfailure);
if(init_pinerc_debugging){
- dprint((2, init_pinerc_debugging));
+ dprint((2, "%s", init_pinerc_debugging));
fs_give((void **)&init_pinerc_debugging);
}
diff --git a/alpine/mailview.c b/alpine/mailview.c
index b9e9650d..0738c376 100644
--- a/alpine/mailview.c
+++ b/alpine/mailview.c
@@ -2140,22 +2140,23 @@ int
url_local_fragment(char *fragment)
{
SCRLCTRL_S *st = scroll_state(SS_CUR);
- HANDLE_S *hp;
+ HANDLE_S *hp = NULL;
/*
* find a handle with the fragment's name
*/
- for(hp = st->parms->text.handles; hp; hp = hp->next)
- if(hp->type == URL && hp->h.url.name
- && !strcmp(hp->h.url.name, fragment + 1))
- break;
-
- if(!hp)
- for(hp = st->parms->text.handles->prev; hp; hp = hp->prev)
- if(hp->type == URL && hp->h.url.name
+ if(st){
+ for(hp = st->parms->text.handles; hp; hp = hp->next)
+ if(hp->type == URL && hp->h.url.name
&& !strcmp(hp->h.url.name, fragment + 1))
break;
+ if(!hp)
+ for(hp = st->parms->text.handles->prev; hp; hp = hp->prev)
+ if(hp->type == URL && hp->h.url.name
+ && !strcmp(hp->h.url.name, fragment + 1))
+ break;
+ }
/*
* set the top line of the display to contain this line
*/