diff options
author | Eric S. Raymond <esr@thyrsus.com> | 1996-11-27 16:31:23 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 1996-11-27 16:31:23 +0000 |
commit | 5c09cbae3e433ed47a60ef02f3146926ac915094 (patch) | |
tree | f8c69e359402e5fd4cd31cf74f28cb52a8d33b69 /pop3.c | |
parent | 714d9da402585a8a10fa97d76f7e0d0a9462a0b9 (diff) | |
download | fetchmail-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.c | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -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); |