From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111c93,c1db52110ef2b04a X-Google-Attributes: gid111c93,public X-Google-Thread: 1103af,c1db52110ef2b04a X-Google-Attributes: gid1103af,public From: Tony Hammitt Subject: Re: sprintf bug? Date: 2000/05/28 Message-ID: <39309CC4.9D388BAB@kc.rr.com>#1/1 X-Deja-AN: 628148848 Content-Transfer-Encoding: 7bit References: <8gmhrd$jqj$1@nnrp1.deja.com> <8gnonp$ec6$1@nnrp1.deja.com> <393001A4.CCFB7638@computelnet.com> X-Accept-Language: en Content-Type: text/plain; charset=us-ascii X-Complaints-To: abuse@rr.com X-Trace: typhoon.kc.rr.com 959487173 24.94.177.44 (Sat, 27 May 2000 23:12:53 CDT) MIME-Version: 1.0 Reply-To: thammitt@kc.rr.com NNTP-Posting-Date: Sat, 27 May 2000 23:12:53 CDT Newsgroups: comp.os.linux.alpha,comp.os.linux.misc sandrews wrote: > > Harlan Grove wrote: > > > > In article <8gmhrd$jqj$1@nnrp1.deja.com>, > > U.V. Ravindra 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 > > > > > > > > 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"