digitalFAQ.com Forums [Archives]

digitalFAQ.com Forums [Archives] (http://www.digitalfaq.com/archives/)
-   Avisynth Scripting (http://www.digitalfaq.com/archives/avisynth/)
-   -   Buffer overflow - long file names (http://www.digitalfaq.com/archives/avisynth/8511-buffer-overflow-long.html)

vipersvcd 03-08-2004 10:07 AM

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

Dialhot 03-08-2004 10:20 AM

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:

vmesquita 03-08-2004 02:10 PM

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:

kwag 03-08-2004 02:38 PM

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 :rotf:

vmesquita 03-08-2004 04:00 PM

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 :rotf:

:lol: :lol: 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... :D 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! :D

Dialhot 03-08-2004 04:05 PM

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

kwag 03-08-2004 06:05 PM

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... :D

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 :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

jonny_eh 03-08-2004 07:56 PM

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

kwag 03-08-2004 07:59 PM

Quote:

Originally Posted by jonny_eh
Wow, this thread is off-topic

I already moved it to the C/C++ section :lol:

-kwag

Dialhot 03-08-2004 08:02 PM

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.

Dialhot 03-08-2004 08:03 PM

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 :lol:

-kwag

Yes, that's what Jonny_eh said : the thread is off-toppic :o

kwag 03-08-2004 08:29 PM

Quote:

Originally Posted by Dialhot
Yes, that's what Jonny_eh said : the thread is off-toppic :o

Yes, but it's closer to C/C++ than it is to DIKO (the original thread) :P

-kwag


All times are GMT -5. The time now is 03:05 PM  —  vBulletin © Jelsoft Enterprises Ltd

Site design, images and content © 2002-2024 The Digital FAQ, www.digitalFAQ.com
Forum Software by vBulletin · Copyright © 2024 Jelsoft Enterprises Ltd.