Click here to Skip to main content
15,888,984 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Windows has triggered a breakpoint in xxxxx, This may be due a corruption of the heap Pin
sdancer7510-Nov-11 9:29
sdancer7510-Nov-11 9:29 
GeneralRe: Windows has triggered a breakpoint in xxxxx, This may be due a corruption of the heap Pin
Chris Losinger10-Nov-11 10:03
professionalChris Losinger10-Nov-11 10:03 
GeneralRe: Windows has triggered a breakpoint in xxxxx, This may be due a corruption of the heap Pin
sdancer7510-Nov-11 21:52
sdancer7510-Nov-11 21:52 
AnswerRe: Windows has triggered a breakpoint in xxxxx, This may be due a corruption of the heap Pin
Chuck O'Toole10-Nov-11 16:35
Chuck O'Toole10-Nov-11 16:35 
AnswerRe: Windows has triggered a breakpoint in xxxxx, This may be due a corruption of the heap Pin
jschell10-Nov-11 8:38
jschell10-Nov-11 8:38 
GeneralRe: Windows has triggered a breakpoint in xxxxx, This may be due a corruption of the heap Pin
sdancer7510-Nov-11 9:32
sdancer7510-Nov-11 9:32 
GeneralRe: Windows has triggered a breakpoint in xxxxx, This may be due a corruption of the heap Pin
Richard MacCutchan10-Nov-11 11:33
mveRichard MacCutchan10-Nov-11 11:33 
AnswerRe: Windows has triggered a breakpoint in xxxxx, This may be due a corruption of the heap PinPopular
Chuck O'Toole10-Nov-11 9:42
Chuck O'Toole10-Nov-11 9:42 
Arrrgh. Warning Warning. You are messing with the fundamental forces of the universe.

The CString object goes out of its way to hide the string buffer from you. It manages that buffer itself, manages as in "keeps track of the size and allocation / location" and is free to move it around as it sees fit (like when you add / concatenate / change the contents).

Here, you've used "GetBuffer()" to find out where the string lives, and then proceed to write all over it with strcpy(). Even if you string sizes are fine and the lengths are initialized, etc, you are writing into a buffer you don't own, CString owns it.

This will almost always cause some sort of corruption.

Do not write into buffers you do not own nor control the size of.

I don't know how to say that strongly enough.

PS, you could at least help CString by telling it how big a buffer you wish to write into, like using "GetBuffer(sizeof(Signature))" but, even then, as others have pointed out, Signature is not initialized so who knows how many characters strcpy() will try to move.

Check the docs for GetBuffer() for more information about what you have to do when you done fiddling the buffer, assuming you use the right size. http://msdn.microsoft.com/en-us/library/aa314880(v=VS.60).aspx[^]
GeneralRe: Windows has triggered a breakpoint in xxxxx, This may be due a corruption of the heap Pin
Albert Holguin10-Nov-11 14:54
professionalAlbert Holguin10-Nov-11 14:54 
AnswerRe: Windows has triggered a breakpoint in xxxxx, This may be due a corruption of the heap Pin
Richard Andrew x6410-Nov-11 9:44
professionalRichard Andrew x6410-Nov-11 9:44 
GeneralRe: Windows has triggered a breakpoint in xxxxx, This may be due a corruption of the heap Pin
sdancer7510-Nov-11 21:49
sdancer7510-Nov-11 21:49 
AnswerRe: Windows has triggered a breakpoint in xxxxx, This may be due a corruption of the heap Pin
Erudite_Eric10-Nov-11 20:59
Erudite_Eric10-Nov-11 20:59 
GeneralRe: Windows has triggered a breakpoint in xxxxx, This may be due a corruption of the heap Pin
sdancer7510-Nov-11 21:55
sdancer7510-Nov-11 21:55 
QuestionOld style JPEG compression Tiff file problem Pin
Hadi Dayvary10-Nov-11 7:02
professionalHadi Dayvary10-Nov-11 7:02 
AnswerRe: Old style JPEG compression Tiff file problem Pin
Chris Losinger10-Nov-11 8:20
professionalChris Losinger10-Nov-11 8:20 
GeneralRe: Old style JPEG compression Tiff file problem Pin
Hadi Dayvary10-Nov-11 22:28
professionalHadi Dayvary10-Nov-11 22:28 
GeneralRe: Old style JPEG compression Tiff file problem Pin
Chris Losinger11-Nov-11 1:18
professionalChris Losinger11-Nov-11 1:18 
GeneralRe: Old style JPEG compression Tiff file problem Pin
Hadi Dayvary11-Nov-11 19:05
professionalHadi Dayvary11-Nov-11 19:05 
QuestionPreTranslateMessage runs twice in VC 6.0 MFC Pin
Vaclav_10-Nov-11 3:09
Vaclav_10-Nov-11 3:09 
Questionfopen fails to give error when UAC is enabled Pin
sindhumahe10-Nov-11 0:54
sindhumahe10-Nov-11 0:54 
QuestionRe: fopen fails to give error when UAC is enabled Pin
Code-o-mat10-Nov-11 1:49
Code-o-mat10-Nov-11 1:49 
AnswerRe: fopen fails to give error when UAC is enabled Pin
sindhumahe10-Nov-11 2:04
sindhumahe10-Nov-11 2:04 
GeneralRe: fopen fails to give error when UAC is enabled Pin
Code-o-mat10-Nov-11 2:18
Code-o-mat10-Nov-11 2:18 
QuestionRe: fopen fails to give error when UAC is enabled Pin
David Crow10-Nov-11 2:35
David Crow10-Nov-11 2:35 
AnswerRe: fopen fails to give error when UAC is enabled Pin
Chris Meech10-Nov-11 2:46
Chris Meech10-Nov-11 2:46 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.