473,491 Members | 2,074 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Buffer overrun bug in ATL CPath functions.


There are a couple of bugs in the atlpath.h file that ships with
DevStudio 2003 and DevStudio 2005 Beta 1 & 2. These bugs result in
buffer overrun and memory corruption problems. After experiencing some
memory corruption I traced the problems to CPathT::AddBackslash() and
CPathT::Append(). These are offending lines in each of the functions
along with an explanation of what is wrong with them.

void AddBackslash()
{
...
// Buffer will be large enough for the appended backslash but not
// the ‘\0’ string terminator
pszBuffer = m_strPath.GetBuffer( m_strPath.GetLength()+1 );
...
}

BOOL Append( __in PCXSTR pszMore )
{
...
// Buffer will be large enough for both strings and the separating
// backslash but not the ‘\0’ string terminator
pszBuffer = m_strPath.GetBuffer( m_strPath.GetLength()

+StringType::StringLength(

pszMore)+1);
...
}

It would be great if these 2 problems could be fixed in the Devstudio
2005 RTM.

Regards,
John Hensley
SmartSoft

Nov 17 '05 #1
1 1638
John Hensley wrote:
There are a couple of bugs in the atlpath.h file that ships with
DevStudio 2003 and DevStudio 2005 Beta 1 & 2. These bugs result in
buffer overrun and memory corruption problems. After experiencing some
memory corruption I traced the problems to CPathT::AddBackslash() and
CPathT::Append(). These are offending lines in each of the functions
along with an explanation of what is wrong with them.

void AddBackslash()
{
...
// Buffer will be large enough for the appended backslash but not
// the '\0' string terminator
pszBuffer = m_strPath.GetBuffer( m_strPath.GetLength()+1 );
...
}

BOOL Append( __in PCXSTR pszMore )
{
...
// Buffer will be large enough for both strings and the separating
// backslash but not the '\0' string terminator
pszBuffer = m_strPath.GetBuffer( m_strPath.GetLength()

+StringType::StringLength(

pszMore)+1);
...
}

It would be great if these 2 problems could be fixed in the Devstudio
2005 RTM.


Please post a bug report at http://lab.msdn.microsoft.com/productfeedback/

-cd
Nov 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
6225
by: inkapyrite | last post by:
Hi all. I'm using ifstream to read from a named pipe but i've encountered an annoying problem. For some reason, the program blocks on reading an ifstream's internal buffer that's only half-filled....
9
5470
by: Sathyaish | last post by:
I noticed that gets() reads into the buffer even if the you've not allocated enough memory. For instance, if you do: char *str=(char*)malloc(sizeof(char)); printf("Enter something about...
4
5638
by: David Sworder | last post by:
Hi there, I come from a Visual C++ background. When writing a service that's exposed to the Internet, I had to check the incoming data stream (from the client) VERY carefully. If a hacker was...
5
1867
by: Senapathy | last post by:
Environment: WinXP, VC++ 7.1 Standard Edition ~~~~~~~~~~~ I have a set of functions that I invoke from main() function of a sample console app. These are the functions:...
8
2806
by: Martin Eisenberg | last post by:
Hi, If I want to terminate a program upon finding that sprintf has overrun its output buffer, should I prefer exit or abort from cstdlib? Thanks. Martin --
0
1464
by: Lonewolf | last post by:
Hi I'm faced with a very pesky problem. I have a managed assembly done in C++/CLI which interface to native C++ codes, and a C# app which consumes this assembly. I realize that when both the app...
1
1372
by: Nico | last post by:
Where can I get it? I am a new comer here, I need your help.
0
1019
by: =?Utf-8?B?QWxmb250eg==?= | last post by:
Looking for some insight into an issue with a MS Word 2003 addin using class serialization to store data. When using firewall software with a ‘Buffer Overflow Exploit Prevention’ feature,...
15
1372
by: raashid bhatt | last post by:
#include <stdio.h> #include <string.h> #include <stdlib.h> void func(char *p) { char i; strcpy(i, p); }
0
7115
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7154
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
6858
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7360
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5451
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4578
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3086
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3076
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
633
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.