Path: utzoo!utgpu!water!watmath!clyde!rutgers!ucsd!ucbvax!hplabs!decwrl!adobe!duplex!shore From: shore@duplex (Andrew Shore) Newsgroups: comp.mail.mh Subject: Re: question about "repl -build" Message-ID: <3549@adobe.COM> Date: 1 Feb 88 22:47:06 GMT References: <22778@ucbvax.BERKELEY.EDU> Sender: nobody@adobe.COM Reply-To: shore@adobe.COM (Andrew Shore) Organization: Adobe Systems Incorporated, Mountain View Lines: 65 In <22778@ucbvax.BERKELEY.EDU>, doublis@ginger.Berkeley.EDU writes: >I'm having a trouble with MH 6.5 running with MHE on sun 3.2. It seems that >"repl -build", which leaves a draft in /reply and exits, is >adding in a couple of extra characters, for example: > To: ... > Subject: .... > In-Reply-To: ... > ------ > es This was happening to us too. I figured it out and sent in a message to bug-mh but never got a reply. I wouldn't be surprised if "es\n" were the last bytes in your .mh_profile. --Andy Shore Adobe Systems Incorporated Index: sbr/formatsbr.c Description: new_fs can create bogus format stings. It reads the "form" file into an area that is malloc'd to have just the right size, but neglects to add a null terminating byte. normalize (and other functions) can go beyond the end of the read in data, formatting things incorrectly. Repeat-By: Happens to me all the time with repl giving me garbage bytes in the prototype repl buffer. Arrange to malloc storage that is non-null in new_fs (seems to happen with a large .mh_profile). Fix: malloc one more byte than the size of the file, and fill it with 0. *** /tmp/,RCSt1a06918 Fri Oct 16 16:07:24 1987 --- formatsbr.c Fri Oct 16 14:04:44 1987 *************** *** 47,53 **** if (fstat (fileno (fp), &st) == NOTOK) adios (form, "unable to stat format file"); ! if ((formats = malloc ((unsigned) st.st_size)) == NULLCP) adios (form, "unable to allocate space for format"); if (read (fileno(fp), formats, st.st_size) != st.st_size) --- 47,53 ---- if (fstat (fileno (fp), &st) == NOTOK) adios (form, "unable to stat format file"); ! if ((formats = malloc ((unsigned) st.st_size + 1)) == NULLCP) adios (form, "unable to allocate space for format"); if (read (fileno(fp), formats, st.st_size) != st.st_size) *************** *** 54,59 **** --- 54,60 ---- adios (form, "error reading format file"); (void) fclose (fp); + formats[st.st_size] = '\0'; } else { formats = getcpy (format ? format : def);