This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Re: [patch] fastjar fix off-by one bug.
- From: Tom Tromey <tromey at redhat dot com>
- To: Andreas Tobler <toa at pop dot agri dot ch>
- Cc: gcc-patches <gcc-patches at gcc dot gnu dot org>, Java Patch List <java-patches at gcc dot gnu dot org>
- Date: 06 Jan 2004 12:01:55 -0700
- Subject: Re: [patch] fastjar fix off-by one bug.
- References: <3FFA50D4.9070806@pop.agri.ch>
- Reply-to: tromey at redhat dot com
>>>>> "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