[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

MiNTlib (I think I'm on pl43): Bug in sprintf().



Well I've had a fun weekend trying to get the NET/2 BSD version of
telnet/in.telnetd running and... I've got telnet working.

During this hacking I found a rather nasty feature of sprintf(), though not
printf(). I've not had a chance to look at the sprintf code at all so I'll
just describe the "feature."

MiNTlib pl 43 (or is it 44.. I'm losing track of patchlevels these days) and
GCC 2.3.3, no optimisation.

When a statement such as the following is run sprintf terminates after the
first argument:-

	sprintf((char *)temp, "%c%c%c%c%s%c%c", IAC, SB, TELOPT_TERMTYPE,
		TELOPT_QUAL, term, IAC, SB);

	where IAC, SB, TELOPT* are all non-ACSII characters with the top bit
	set, ie. 127 < x < 256. The first two are actually (from memory)
	0xff and 0xfa.

All you get in temp is the first byte, ie. 0xff. printf() works correctly.

Steve

PS. This is all from memory, so the first SB may not be correct, but the
value 0xfa is. This, of course, doesn't matter for the bug report as it's to
do with the telnet protocol.

PPS. in.telnetd isn't working.. well it is, partially, it doesn't echo
characters and it loses the first character of every packet it sends! I've
tested telnet by calling my Sun 3/80 and in.telnetd by calling it from the
Sun.

PPPS. MiNTnet's PPP device works well, except for when there's a data
overrun when it gets hopelessly confused and has to be restarted (after
clearing the serial port input buffer using kermit). Kay, could you get your
slattach to set the baud rate of the serial port using a command line option
please so I can place the PPP startup in an rc file and not use kermit to
set the port speed.

-- 
---------------------------------------------------------------------------
Computer Systems Administrator, Dept. of Earth Sciences, Oxford University.
E-Mail: steve@uk.ac.ox.earth (JANET) steve@earth.ox.ac.uk (Internet).
Tel:- Oxford (0865) 282110 (UK) or +44 865 282110 (International).