This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] fastjar fix off-by one bug.


>>>>> "Andreas" == Andreas Tobler <toa@pop.agri.ch> writes:

Andreas> 2004-01-06  Andreas Tobler  <a.tobler@schweiz.ch>
Andreas> 	* jartool.c (make_manifest): Fix off-by-one bug when creating
Andreas> 	an empty MANIFEST.MF.

I hate to keep tweaking on this, but...

Andreas> +/* This defines the length of the following string:
Andreas> +   "Manifest-Version: 1.0\nCreated-By: %s\n\n".
Andreas> +   The \n is counted as one character and the %s isn't counted.
Andreas> +   The version string length is added below.  */
Andreas> +#define MANIFEST_STR_LENGTH 36

How about just doing `strlen (mf) - 1' after computing it?
The idea being, let's get rid of all the bogus-ness in this code and
make it robust in the face of future change.

Tom


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]