🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #17312

Re: Problem in deleting file!

#17312
From: Remy Lebeau (TeamB)
Date: Fri, 28 Mar 2003 20:40
30 lines
1710 bytes
"nicolasr" <nicolasrNOSPAMATSIGNgmx.net> wrote in message
news:3e84ad5c$1@newsgroups.borland.com...

>    char buffer[MAX_PATH+1];

You should allocate 2 extra spaces, not 1, in case the path is very long and
takes up the entire buffer:

    char buffer[MAX_PATH+2] = {0};

>    strcpy(buffer, hPath);

It's always safer to use strncpy() instead ot strcpy() to prevent possible
buffer overflows:

    strncpy(buffer, hPath, MAX_PATH);

>    buffer[strlen(hPath)+1] = '\0';

Not needed, see above.


Gambit


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.463 / Virus Database: 262 - Release Date: 3/17/03
Technical Details
Message-ID: <3e84b0d4$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail
References: <3E8408FF.5040308@alloymail.com> <3e840eac$1@newsgroups.borland.com> <3E842BD0.1060302@alloymail.com> <3e84ad5c$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,5fde27ba165b16db
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-03-28 12:32:48 PST
From: "Remy Lebeau \(TeamB\)" <gambit47@yahoo.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <3E8408FF.5040308@alloymail.com> <3e840eac$1@newsgroups.borland.com> <3E842BD0.1060302@alloymail.com> <3e84ad5c$1@newsgroups.borland.com>
Subject: Re: Problem in deleting file!
Date: Fri, 28 Mar 2003 12:40:08 -0800
Lines: 32
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
NNTP-Posting-Host: 207.175.226.26
Message-ID: <3e84b0d4$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1048883412 207.175.226.26 (28 Mar 2003 12:30:12 -0800)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail