Reducing the risk of overrun bugs being introduced is not a bad thing. The snprintf() you're referring to is doing the C99 standardly thing, but there are versions of snprintf() that treat the 'size' argument as not including the terminator (MS CRT libs is one, there's likely to be others too), so doing the conservative thing here makes good sense. --sigbjorn ----- Original Message ----- From: "Ross Paterson" <ross@soi.city.ac.uk> To: "Sigbjorn Finne" <sof@glass.cse.ogi.edu> Cc: <cvs-hugs@haskell.org> Sent: Friday, July 19, 2002 12:44 Subject: Re: cvs commit: hugs98/src input.c
Sigbjorn,
Modified files: src input.c Log: - fix silly snprintf() usage bug in prev commit.
Under glibc 2.2.5, snprintf copies n bytes including the \0, so this version drops the last character of the filename. But I don't see why this contortion is necessary anyway, since we just malloc'ed an array of exactly the right size.
Ross