Bug#534641: [ptex:00350] Re: mendex bug

2013-09-10 Thread Peter Breitenlohner

On Sat, 7 Sep 2013, Norbert Preining wrote:


On Sa, 07 Sep 2013, Akira Kakuto wrote:

   sprintf(tmpbuff,%s%s%s,encap_prefix,ind.p[j].enc,encap_infix);
   sprintf(tmpbuff,%s%s%s,ind.p[j].page,encap_suffix,delim_n);



that looks suspicious. The tmpbuff is overwritten on the second
incantation, ...


I searched for similar lines in fwrite.c  (see an attached fwrite.c.diff).
I think these are apparently bugs.
If I'm not wrong, please commit them.


Ahh, maybe the intended rewrite was to have
sprintf(TAIL(tmpbuff),%s%s%s,encap_prefix,ind.p[j].enc,encap_infix);
sprintf(TAIL(tmpbuff),%s%s%s,ind.p[j].page,encap_suffix,delim_n);
then it would work 


Hi all,

actually it should be
sprintf(tmpbuff,%s%s%s,encap_prefix,ind.p[j].enc,encap_infix);
sprintf(TAIL(tmpbuff),%s%s%s,ind.p[j].page,encap_suffix,delim_n);
and I have also added a small test case (similar to the one for makeindex).

Please check.

Regards
Peter


--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#534641: [ptex:00350] Re: mendex bug

2013-09-07 Thread Norbert Preining
On Sa, 07 Sep 2013, Akira Kakuto wrote:
sprintf(tmpbuff,%s%s%s,encap_prefix,ind.p[j].enc,encap_infix);
sprintf(tmpbuff,%s%s%s,ind.p[j].page,encap_suffix,delim_n);

 that looks suspicious. The tmpbuff is overwritten on the second
 incantation, ...

 I searched for similar lines in fwrite.c  (see an attached fwrite.c.diff).
 I think these are apparently bugs.
 If I'm not wrong, please commit them.

Ahh, maybe the intended rewrite was to have
sprintf(TAIL(tmpbuff),%s%s%s,encap_prefix,ind.p[j].enc,encap_infix);
sprintf(TAIL(tmpbuff),%s%s%s,ind.p[j].page,encap_suffix,delim_n);
then it would work 

I guess that is the better fix.

What do you think?

Norbert


PREINING, Norbert   http://www.preining.info
JAIST, Japan TeX Live  Debian Developer
DSA: 0x09C5B094   fp: 14DF 2E6C 0307 BE6D AD76  A9C0 D2BF 4AA3 09C5 B094



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org