Vulnerability Development mailing list archives
Re: problem with C and Gcc 2.95.3
From: Doru Petrescu <pdoru () kappa ro>
Date: Sat, 26 May 2001 13:38:19 +0300 (EEST)
let me undeline FEW 'problems' with your little program ... 1. it is #include ... with a hash '#' ... 2. for (i=0;1<10;i++) will LOOP for EVER ... unless you write it as: for (i=0;i<10;i++) ... notice 'i<10' in place of '1<10' ... 3. i can't understand how did it produced this kind of result ... since printf("%d", ...) will print NUMBERS, and can't print a series of dots, like you can see in the output you attached. so i guess the original program had %c or %s ... i put my money on %c ... anyway this kind of questions are better suited for other kind of email lists ... also, a quick DEBUGING should had gave you the answer long time ago ... Best regards, Doru Petrescu On Fri, 25 May 2001, Ale wrote:
I can't run this program: include <stdio.h> main () { char buff[10]; int i; for (i=0;i<10;i++){ buff[i]='.'; } for (i=0;1<10;i++){ printf("%d",buff[i]); } } The program return: ..........??H????l@t???|????t???H????l(@ t????k@x?@A?t???????@l???0.@???????????????? ???(???P???c???????????????????????????????????????????????-???G???\???i???}??????????????????????????????? ??????/???=???K???\???j???u???????????????????????????4 @ ? ???????i686./5PWD=/root/prg/myLTDL_LIBRARY_PATH=/root/.kde/lib:/usr/libLC_MESSAGES=itHOSTNAME=localhost.localdomainLD_LIBRARY_PATH=/root/.kde/lib:/usr/libLESSKEY=/etc/.lessLESSOPEN=|/usr/bin/lesspipe.sh %sLANGUAGE=it_IT:itENV=/root/.bashrcPS1=[\u@\h \W]\$ KDEDIR=/usrLESS=-MMBROWSER=/usr/bin/netscapeUSER=rootLS_COLORS=no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:bd=40;33;01:cd=40;33;01:or=01;05;37;41:mi=01;05;37;41:ex=01;32:*.cmd=01;32:*.exe=01;32:*.com=01;32:*.btm=01;32:*.bat=01;32:*.tar=01;31:*.tgz=01;31:*.tbz2=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.Segmentation fault (core dumped) I have compiled this with gcc version 2.95.3 It's a bug ?
Current thread:
- problem with C and Gcc 2.95.3 Ale (May 25)
- Re: problem with C and Gcc 2.95.3 Yuri Polyansky (May 26)
- Re: problem with C and Gcc 2.95.3 Doru Petrescu (May 26)
- Re: problem with C and Gcc 2.95.3 Blue Boar (May 26)
- Re: problem with C and Gcc 2.95.3 Jeroen Latour (May 26)
- Re: problem with C and Gcc 2.95.3 Riley Hassell (May 26)
- Re: problem with C and Gcc 2.95.3 Blue Boar (May 26)