Quantcast Buffer Overflow - Long File Names - digitalFAQ.com Forums [Archives]
  #1  
03-08-2004, 10:07 AM
vipersvcd vipersvcd is offline
Free Member
 
Join Date: Mar 2004
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
try these 2 methods: although i dont know how diko is based .
1.
Simply substitute

char buf[100];

with

char buf[BUFSIZE];
all

sprintf(buf, ...

statements with

snprintf(buf, BUFSIZE, ...

where BUFSIZE could be defined as
#define BUFSIZE 256
somewhere in the .cpp file.

sprintf should'nt be used anyway

2.
http://www.opengroup.org/onlinepubs/.../limits.h.html
Reply With Quote
Someday, 12:01 PM
admin's Avatar
Site Staff / Ad Manager
 
Join Date: Dec 2002
Posts: 42
Thanks: ∞
Thanked 42 Times in 42 Posts
  #2  
03-08-2004, 10:20 AM
Dialhot Dialhot is offline
Free Member
 
Join Date: May 2003
Posts: 10,463
Thanks: 0
Thanked 0 Times in 0 Posts
I'm not sure the forum is the place to discuss about C language trick.
Please, I'm coding all the day in C at the office and I come on the board to have a break
Reply With Quote
  #3  
03-08-2004, 02:10 PM
vmesquita vmesquita is offline
Invalid Email / Banned / Spammer
 
Join Date: May 2003
Posts: 3,726
Thanks: 0
Thanked 0 Times in 0 Posts
Actually even char* shouldn't be used, there are good and safe string libraires like wxString, std::string and so on. But when I was developing the initial command-line version, I couldn't find another way to create custom command-lines to run auxiliary software. For now, I'll just increase the buffer to 4096 (I have been using 255), I am sure 4 kb of extra memory won't make any difference to anyone. In the future, I'll use a good string library.
Reply With Quote
  #4  
03-08-2004, 02:38 PM
kwag kwag is offline
Free Member
 
Join Date: Apr 2002
Location: Puerto Rico, USA
Posts: 13,537
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by vmesquita
I am sure 4 kb of extra memory won't make any difference to anyone.
Oh no
4KB, that's the size of the complete RAM on a ZX81 basic computer, and you're using it just for a file name
Reply With Quote
  #5  
03-08-2004, 04:00 PM
vmesquita vmesquita is offline
Invalid Email / Banned / Spammer
 
Join Date: May 2003
Posts: 3,726
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by kwag
Oh no
4KB, that's the size of the complete RAM on a ZX81 basic computer, and you're using it just for a file name
Makes me remember my first computer, a 8-bit Z80 based "MSX", that had 64 kb of memory and could be expanded to 128 kb... I created lots of programs using the built in BASIC language in this back when I was a kid, it was so much fun... I still got the MSX but isn't working properly anymore. Other day I saw a guy selling a still working MSX for 20 reais (about US$ 6.5) and I almost bought it!
Reply With Quote
  #6  
03-08-2004, 04:05 PM
Dialhot Dialhot is offline
Free Member
 
Join Date: May 2003
Posts: 10,463
Thanks: 0
Thanked 0 Times in 0 Posts
MSX ! It was supposed to become the new standard for home computers as all Japan brands sign in the white book : they were all supposed to do computers compatible between them. But soon came the msx2 (with 128 Kb insteed of 64) and almost no MSX computer never communicate an other one .

Reply With Quote
  #7  
03-08-2004, 06:05 PM
kwag kwag is offline
Free Member
 
Join Date: Apr 2002
Location: Puerto Rico, USA
Posts: 13,537
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by vmesquita
I created lots of programs using the built in BASIC language in this back when I was a kid, it was so much fun...
I believe you. I had more fun writing programs in my Atari 800, than writing programs on a PC
Tight resources always forced you to make tight and efficient programs.
Now, we just throw away memory, and OSs are very inefficient.
Look at a "Hello World" program written in VB, where the .exe is over 2MB
Talk about bloat
Before, you had a complete "Space Invaders" game written in only 8KB for an arcade machine
What happened I think the industry went to "The Twilight Zone"

-kwag
Reply With Quote
  #8  
03-08-2004, 07:56 PM
jonny_eh jonny_eh is offline
Free Member
 
Join Date: Jan 2004
Location: Canada
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Doesn't anyone write assembly anymore?

I think the last applications that were pure assembly on PCs were console emulators in the late 90s.

Actually I found a modern RTS game programmed purely in assembly, can't remember the name.

Wow, this thread is off-topic
Reply With Quote
  #9  
03-08-2004, 07:59 PM
kwag kwag is offline
Free Member
 
Join Date: Apr 2002
Location: Puerto Rico, USA
Posts: 13,537
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by jonny_eh
Wow, this thread is off-topic
I already moved it to the C/C++ section

-kwag
Reply With Quote
  #10  
03-08-2004, 08:02 PM
Dialhot Dialhot is offline
Free Member
 
Join Date: May 2003
Posts: 10,463
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by jonny_eh
Doesn't anyone write assembly anymore?
Some people wrote even directly APIC code. For instance peoples that do ripped RPC1 firmware for DVD driver. As they have to do reverse ingeenering on the original firmware, they talk directly the language used by the EEPROM ! Te same for people turning standalones into multizone.
Reply With Quote
  #11  
03-08-2004, 08:03 PM
Dialhot Dialhot is offline
Free Member
 
Join Date: May 2003
Posts: 10,463
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by kwag
Quote:
Originally Posted by jonny_eh
Wow, this thread is off-topic
I already moved it to the C/C++ section

-kwag
Yes, that's what Jonny_eh said : the thread is off-toppic
Reply With Quote
  #12  
03-08-2004, 08:29 PM
kwag kwag is offline
Free Member
 
Join Date: Apr 2002
Location: Puerto Rico, USA
Posts: 13,537
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by Dialhot
Yes, that's what Jonny_eh said : the thread is off-toppic
Yes, but it's closer to C/C++ than it is to DIKO (the original thread) :P

-kwag
Reply With Quote
Reply




Similar Threads
Thread Thread Starter Forum Replies Last Post
HeadAC3he: Downmix overflow?! audioslave Audio Conversion 0 12-22-2003 08:30 PM
KVCD: Buffer underflow? big Video Encoding and Conversion 3 04-26-2003 12:32 PM
KVCD: Long-Term View for AVI File to VCD? big General Discussion 7 03-23-2003 07:48 PM
KVCD: tok claims floating point overflow? boeddha Video Encoding and Conversion 2 03-21-2003 06:01 AM
KVCD: Using KVCDx2 1-CD, how long is too long? srsstvs Video Encoding and Conversion 9 07-01-2002 04:19 PM

Thread Tools



 
All times are GMT -5. The time now is 02:23 AM  —  vBulletin © Jelsoft Enterprises Ltd