buffer overflow - long file names
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 |
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 :grin: |
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. :wink:
|
Quote:
4KB, that's the size of the complete RAM on a ZX81 basic computer, and you're using it just for a file name :rotf: |
Quote:
|
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 :-).
:-D |
Quote:
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 :hihi: Talk about bloat :roll: Before, you had a complete "Space Invaders" game written in only 8KB for an arcade machine :!: :!: What happened :?: :arrow: I think the industry went to "The Twilight Zone" :!: -kwag |
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 |
Quote:
-kwag |
Quote:
|
Quote:
|
Quote:
-kwag |
Site design, images and content © 2002-2024 The Digital FAQ, www.digitalFAQ.com
Forum Software by vBulletin · Copyright © 2024 Jelsoft Enterprises Ltd.