alpine/chappa-unixnullbug.patch

46 lines
1.4 KiB
Diff
Raw Normal View History

diff -rc alpine-2.10/imap/src/c-client/mail.c alpine-2.10.unixnullbug/imap/src/c-client/mail.c
*** alpine-2.10/imap/src/c-client/mail.c 2013-01-11 15:21:34.000000000 -0700
--- alpine-2.10.unixnullbug/imap/src/c-client/mail.c 2013-01-11 20:45:05.000000000 -0700
***************
*** 3352,3364 ****
long flags)
{
STRINGLIST *hdrs;
! int notfound;
unsigned long i;
char c,*s,*e,*t,tmp[MAILTMPLEN];
char *src = text;
char *dst = src;
char *end = text + len;
! text[len] = '\012'; /* guard against running off buffer */
while (src < end) { /* process header */
/* slurp header line name */
for (s = src,e = s + MAILTMPLEN - 1,e = (e < end ? e : end),t = tmp;
--- 3352,3364 ----
long flags)
{
STRINGLIST *hdrs;
! int notfound, fix = text[len - 1] == '\0';
unsigned long i;
char c,*s,*e,*t,tmp[MAILTMPLEN];
char *src = text;
char *dst = src;
char *end = text + len;
! text[fix ? len - 1 : len] = '\012'; /* guard against running off buffer */
while (src < end) { /* process header */
/* slurp header line name */
for (s = src,e = s + MAILTMPLEN - 1,e = (e < end ? e : end),t = tmp;
***************
*** 3397,3402 ****
--- 3397,3406 ----
}
}
*dst = '\0'; /* tie off destination */
+ if(fix){
+ text[len] = '\012';
+ text[len-1] = '\0';
+ }
return dst - text;
}