Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Corruption of temporary BAT files for Custom Build Steps (VC++)
Issue:       Corruption of temporary BAT files for Custom Build Steps
Type:        Buffer overflow, when using variable expansion (/macros)
Affected:    VS 2003 only(?)
Reproduce:   Use attached project
Requirement: Project is unzipped in Root of the given drive, such that
the project resides in for example
D:\CustomBuildstepCorrupted
(Other directories may be used, but then changes are
necessary to reproduce the problem)

---------------------------------------------------------------------
Details:
If you create a Custom Build Step which contains a certain number of
characters, _and_ you use variable expansion (or so-called macros) in
the step, it might fail.

It seem that if the buffer is between 2085-#chars_expanded and 2102
bytes, there is a buffer overflow. This truncates all, but the first
character on the first line, and the last line. So,

echo This is the 1st line
echo This is the 2nd line
echo This is the 3rd line
echo This is the 4th line
$(SolutionDir)bin\generate.bat

(please ignore the > 2085-#chars_expanded and < 2102 requirement, and
imagine that SolutionDir is set to "C:\CustomBuildstepCorrupted\") then
turns into

 eC:\CustomBuildstepCorrupted\bin\generat
e.bat

which, of course, fails brilliantly every time.
So, it seems that variable expansion wasn't taken into consideration
when calculating the buffer size needed to store the output of the
temporary BAT file used the running Custom Build Steps.


Now, since this problem is only triggered in a very narrow region of
buffer size, (it depends on how much is expanded) it can easily be
circumvented by "padding" the Custom Build Step to pass the upper limit
of 2102 characters.

I assume passing the 2102 boundary only triggers the usage of a larger
buffer, which when close to its boundary, also has the same problem.

Can anyone confirm this bug, and does anyone know of other boundaries
(say for the next size limit)?

Also, I've tested the attached project with both VS2002 & VS2005beta.
While none of them actually failed on this particular project, I'm
still not sure that the same problem doesn't exist there. They might
simply be at other buffer sizes. Can anyone confirm the existence/non-
existence of this bug in 2002 & 2005?

Is there planned any SP for VS2003? If so, when, and would a fix for
this issue be feasible in that SP?

Sincerely,
Marius Storm-Olsen



Report this thread to moderator Post Follow-up to this message
Old Post
Marius Storm-Olsen
12-29-04 01:57 PM


RE: Corruption of temporary BAT files for Custom Build Steps (VC++)
Hi Marius,

I have post a reply to this issue in the group
microsoft.public.vc.ide_general, please check it there.


Thanks for your understanding!

Best regards,

Gary Chang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------


Report this thread to moderator Post Follow-up to this message
Old Post
Gary Chang[MSFT]
12-30-04 01:57 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Visual Studio archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 08:48 AM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.