Click here to Skip to main content
15,889,335 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: programmer Pin
Alan Balkany28-Sep-10 4:16
Alan Balkany28-Sep-10 4:16 
AnswerRe: programmer Pin
jeron127-Sep-10 11:33
jeron127-Sep-10 11:33 
Question"return 0" in user defined function Pin
AmbiguousName27-Sep-10 8:36
AmbiguousName27-Sep-10 8:36 
AnswerRe: "return 0" in user defined function Pin
Phil J Pearson27-Sep-10 9:00
Phil J Pearson27-Sep-10 9:00 
AnswerRe: "return 0" in user defined function Pin
pjdriverdude27-Sep-10 9:02
pjdriverdude27-Sep-10 9:02 
AnswerRe: "return 0" in user defined function Pin
Maximilien27-Sep-10 9:08
Maximilien27-Sep-10 9:08 
Questionchar data type problem Pin
pjdriverdude27-Sep-10 7:20
pjdriverdude27-Sep-10 7:20 
AnswerRe: char data type problem Pin
Luc Pattyn27-Sep-10 7:53
sitebuilderLuc Pattyn27-Sep-10 7:53 
Hi,

it is not completely clear to me. Here are some ideas:

1.
as temporary_file_path is initially empty, the first strncat better be a strncpy.

2.
your overrun protection is not effective:
strncat( buffer, data, sizeof(buffer));

if buffer initially holds 10 chars, you will overrun it by 10 (assuming data is a long string).
you should either calculate how many buffer positions remain and use that as count, or use a safer version of strcat/strcpy.

3.
there is something quite illogical in using the same buffer (voice_template_g[26]) for input and output.
Assume it is almost full at input; your code creates a longer path (path+initial content of buffer). then
copies that back into the input buffer.

4.
And then there is the problem of string functions not ensuring there will be a terminating NULL. (When they reach the count limit before reaching the source's NULL, no NULL is copied nor appended).

5.
I can imagine situations where things run fine the first time around, and fail the second time around, maybe because voice_template_g now contains the earlier result.

6.
you should add log statements and/or use your debugger's facilities to inspect the data in the buffers.


Smile | :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.


QuestionRe: char data type problem Pin
David Crow27-Sep-10 8:30
David Crow27-Sep-10 8:30 
AnswerRe: char data type problem Pin
pjdriverdude27-Sep-10 8:55
pjdriverdude27-Sep-10 8:55 
QuestionRe: char data type problem Pin
David Crow27-Sep-10 9:00
David Crow27-Sep-10 9:00 
AnswerRe: char data type problem Pin
pjdriverdude27-Sep-10 9:04
pjdriverdude27-Sep-10 9:04 
QuestionRe: char data type problem Pin
David Crow27-Sep-10 9:05
David Crow27-Sep-10 9:05 
AnswerRe: char data type problem Pin
pjdriverdude27-Sep-10 9:33
pjdriverdude27-Sep-10 9:33 
GeneralRe: char data type problem Pin
David Crow27-Sep-10 9:35
David Crow27-Sep-10 9:35 
AnswerRe: char data type problem Pin
Aescleal27-Sep-10 8:33
Aescleal27-Sep-10 8:33 
GeneralRe: char data type problem Pin
pjdriverdude27-Sep-10 8:57
pjdriverdude27-Sep-10 8:57 
GeneralRe: char data type problem Pin
Luc Pattyn27-Sep-10 10:19
sitebuilderLuc Pattyn27-Sep-10 10:19 
AnswerRe: char data type problem Pin
Stefan_Lang29-Sep-10 6:51
Stefan_Lang29-Sep-10 6:51 
GeneralRe: char data type problem Pin
pjdriverdude1-Oct-10 5:31
pjdriverdude1-Oct-10 5:31 
GeneralRe: char data type problem Pin
Stefan_Lang3-Oct-10 22:50
Stefan_Lang3-Oct-10 22:50 
Questionis mfc coding diff [Moved] Pin
prithaa27-Sep-10 3:35
prithaa27-Sep-10 3:35 
AnswerRe: is mfc coding diff Pin
bob1697227-Sep-10 4:16
bob1697227-Sep-10 4:16 
GeneralRe: is mfc coding diff Pin
prithaa27-Sep-10 6:27
prithaa27-Sep-10 6:27 
QuestionCustomizing the Help button in CPrintDialog Pin
rayneesh27-Sep-10 3:04
rayneesh27-Sep-10 3:04 

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.