From: Tony Hammitt <thammitt@kc.rr.com>
Subject: Re: sprintf bug?
Date: 2000/05/28 [thread overview]
Message-ID: <39309CC4.9D388BAB@kc.rr.com> (raw)
In-Reply-To: 393001A4.CCFB7638@computelnet.com
sandrews wrote:
>
> Harlan Grove wrote:
> >
> > In article <8gmhrd$jqj$1@nnrp1.deja.com>,
> > U.V. Ravindra <uvr@usa.net> wrote:
> > >
> > > I'm using SuSE 6.3 (Kernel 2.2.13 glibc 2.1.2) on an Alpha EV67.
> > > Here's what I'm trying to do
> > >
> > > char buffr[4096+1]
> > >
> > > ...
> > > ...
> > > printf("before %s\n", buffr);
> > > sprintf(buffr, "0, 0, 0, ");
> > > printf("after %s\n", buffr);
> > >
> > > And I see the output:
> > >
> > > before dwki_nr_ibind(100, fname_var, 0,
> > > after 0, 0, 0,i
> >
> > <snip>
> >
> > Looks like a bug, but one not shared by i386 Red Hat 6.0 at least.
> >
>
> This is NOT a bug, buffr contains junk @ the first printf statement.
>
> --
What junk are you talking about? There is something else in the
string before the sprintf statement, so what? Lots of people use
the same buffer over and over again in a function. It saves space
and speeds things up.
The string should be "0, 0, 0, " not "0, 0, 0,i". The last space
is missing and other buffer contents were left in its place. UVR
posted a code fragment, not the whole program.
This is most certainly a bug.
Regards,
Tony
> "You can open self extracting archives using PKZIP25.EXE
> or unrar" - censored by Microsoft."
> "You can unzip a self extracting .EXE with WinZip" -BANNED BY MICROSOFT"
next prev parent reply other threads:[~2000-05-28 4:00 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-05-26 4:00 sprintf bug? U.V. Ravindra
2000-05-26 4:00 ` Andreas Kahari
2000-05-26 4:00 ` U.V. Ravindra
2000-05-27 4:00 ` Tony Hammitt
2000-05-27 4:00 ` Harlan Grove
2000-05-27 4:00 ` sandrews
2000-05-28 4:00 ` Tony Hammitt [this message]
2000-05-27 4:00 ` Juergen Heinzl
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox