summaryrefslogtreecommitdiff
path: root/alpine/osdep
diff options
context:
space:
mode:
authorEduardo Chappa <chappa@washington.edu>2016-08-11 21:14:43 -0600
committerEduardo Chappa <chappa@washington.edu>2016-08-11 21:14:43 -0600
commitaa5a0714e2ae3c401ac9e6901dde87ad70568d8c (patch)
tree77499e2bf845fe982004d88fb42a71ed8a15ccd7 /alpine/osdep
parent3d3df2b3153af567b6b17c05052ab21e9b2e9a00 (diff)
downloadalpine-aa5a0714e2ae3c401ac9e6901dde87ad70568d8c.tar.xz
* Protect all calls to mail_elt in pith/ and alpine/ code. Protect means
to check for correct range of message number before calling mail_elt. * Work in progress: correct some uses of system calls that do not check for returned value. This work will follow the lead given by Christian Kujau and Asheesh Laroia. Expect more changes of this type in subsequent commits.
Diffstat (limited to 'alpine/osdep')
-rw-r--r--alpine/osdep/termin.unx.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/alpine/osdep/termin.unx.c b/alpine/osdep/termin.unx.c
index 35fde428..0cb9aad1 100644
--- a/alpine/osdep/termin.unx.c
+++ b/alpine/osdep/termin.unx.c
@@ -732,8 +732,10 @@ pre_screen_config_opt_enter(char *string, int string_size, char *prompt,
return_v = 0;
}
else{
- fputs("Password too long\n", stderr);
- return_v = -1;
+ if(fputs("Password too long\n", stderr) != EOF)
+ return_v = -1;
+ else
+ alpine_panic(_("error on fputs() call!"));
}
}
else
@@ -742,13 +744,15 @@ pre_screen_config_opt_enter(char *string, int string_size, char *prompt,
else{
char *p;
- fputs(prompt, stdout);
- fgets(string, string_size, stdin);
- string[string_size-1] = '\0';
- if((p = strpbrk(string, "\r\n")) != NULL)
- *p = '\0';
-
- return_v = 0;
+ if(fputs(prompt, stdout) != EOF
+ && fgets(string, string_size, stdin) != NULL){
+ string[string_size-1] = '\0';
+ if((p = strpbrk(string, "\r\n")) != NULL)
+ *p = '\0';
+ return_v = 0;
+ }
+ else
+ alpine_panic(_("error on fputs() or fgets() call!"));
}
}