summaryrefslogtreecommitdiff
path: root/imap/src/c-client/newsrc.c
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 /imap/src/c-client/newsrc.c
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 'imap/src/c-client/newsrc.c')
-rw-r--r--imap/src/c-client/newsrc.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/imap/src/c-client/newsrc.c b/imap/src/c-client/newsrc.c
index 8036b1ac..0f15264d 100644
--- a/imap/src/c-client/newsrc.c
+++ b/imap/src/c-client/newsrc.c
@@ -1,6 +1,6 @@
/*
* Copyright 2016 - Eduardo Chappa
- * Last Modified: June 15, 2016
+ * Last Modified: August 11, 2016
*/
/* ========================================================================
* Copyright 1988-2006 University of Washington
@@ -471,8 +471,9 @@ char *newsrc_state (MAILSTREAM *stream,char *group)
c = getc (f);
/* now copy it */
s = (char *) fs_get (size + 1);
- fseek (f,pos,SEEK_SET);
- fread (s,(size_t) 1,size,f);
+ if(fseek (f,pos,SEEK_SET) < 0
+ || fread (s,(size_t) 1,size,f) != size)
+ fatal("error on fseek() or fread() in newsrc module.");
s[size] = '\0'; /* tie off string */
fclose (f); /* all done - close the file */
return s;