aboutsummaryrefslogtreecommitdiffstats
path: root/pop3.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>1996-11-27 16:31:23 +0000
committerEric S. Raymond <esr@thyrsus.com>1996-11-27 16:31:23 +0000
commit5c09cbae3e433ed47a60ef02f3146926ac915094 (patch)
treef8c69e359402e5fd4cd31cf74f28cb52a8d33b69 /pop3.c
parent714d9da402585a8a10fa97d76f7e0d0a9462a0b9 (diff)
downloadfetchmail-5c09cbae3e433ed47a60ef02f3146926ac915094.tar.gz
fetchmail-5c09cbae3e433ed47a60ef02f3146926ac915094.tar.bz2
fetchmail-5c09cbae3e433ed47a60ef02f3146926ac915094.zip
Avoid malloc overrun core-dump.
svn path=/trunk/; revision=574
Diffstat (limited to 'pop3.c')
-rw-r--r--pop3.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/pop3.c b/pop3.c
index 79260f16..f2e46236 100644
--- a/pop3.c
+++ b/pop3.c
@@ -80,14 +80,15 @@ int pop3_getauth(FILE *sockfp, struct query *ctl, char *greeting)
/* find end of timestamp */
for (end = start; *end != 0 && *end != '>'; end++)
continue;
- if (*end == 0 || (end - start - 1) == 1) {
+ if (*end == 0 || end == start + 1) {
fprintf(stderr,"Timestamp syntax error in greeting\n");
return(PS_AUTHFAIL);
}
+ else
+ *++end = '\0';
/* copy timestamp and password into digestion buffer */
- msg = (char *)xmalloc((end-start-1) + strlen(ctl->password) + 1);
- *(++end) = 0;
+ msg = (char *)xmalloc((end-start+1) + strlen(ctl->password) + 1);
strcpy(msg,start);
strcat(msg,ctl->password);